I have a website I'm building that uses a horizontal layout on desktop and switches back to a native vertical layout on smaller screens. I'm using locomotive scroll, which is working great, but I can't seem to get the window resizing down.
Here is the function for large screens
const lscroll = new LocomotiveScroll({
el: document.querySelector('[data-scroll-container]'),
smooth: true,
direction: 'horizontal'
});
and on window.resize events, if the width goes below the mobile threshold, I tried to just destroy it and call it again, but with a direction of "vertical" instead of "horizontal".
const lscroll = new LocomotiveScroll({
el: document.querySelector('[data-scroll-container]'),
smooth: true,
direction: 'vertical'
});
lscroll.destroy();
lscroll.init();
Any ideas?