I am currently working on a website that is designed with a horizontal layout for desktop screens, but switches to a vertical layout for smaller screens. I have implemented locomotive scroll successfully, but I am facing issues with window resizing.
Below is the code snippet for large screens:
const lscroll = new LocomotiveScroll({
el: document.querySelector('[data-scroll-container]'),
smooth: true,
direction: 'horizontal'
});
During window resize events, when the width falls below the mobile threshold, I attempted to destroy and initialize it again with a vertical direction instead of horizontal:
const lscroll = new LocomotiveScroll({
el: document.querySelector('[data-scroll-container]'),
smooth: true,
direction: 'vertical'
});
lscroll.destroy();
lscroll.init();
Any suggestions or solutions are welcome!