Question:
How I can rotate uploaded Hamberger Menu Icon When I scrolled page up and down?
I am trying to create add a scroll effect of Menu Icon by wix studio but it is not working.
Need also icon menu position fixed when scrolled up and down the screen?
My custom Code:
import wixWindow from ‘wix-window’;
$w.onReady(function () {
wixWindow.getBoundingRect()
.then(() => {
// Start the scroll listener
wixWindow.scroll.onScroll(() => {
const scrollY = wixWindow.scroll.scrollY;
const scrollHeight = wixWindow.scroll.scrollHeight;
const viewportHeight = wixWindow.scroll.viewportHeight;
const scrollRatio = scrollY / (scrollHeight - viewportHeight);
const rotateAngle = scrollRatio * 360;
$w("#rotatingIcon").style.transform = `rotate(${rotateAngle}deg)`;
});
});
});