Hey guys, I’m trying to make a full-view height slider change slides on mouse scroll up and down. I’m using the generic slider element in webflow with a few interactions.
I previously looked into this and recall exploring two different approaches. I never followed through with implementation but figure it still may be helpful to share some of my insights.
Approach 1:
Custom script that works with the native slider component .js code. This approach is very risky since we don’t know if/when Webflow will update their codebase.
Approach 2:
Custom script that calls the prev/next slide based on wheel event (exactly as you have), with the following additions:
Binding the script’s wheel event within a specific div - This is important if you dont plan to have the slider take up entire page.
Adding Debounce function to ensure the task doesn’t fire so often that it messes up performance (I believe this addresses your speed concern).
Approach 3:
Using something completely outside the native Webflow codebase (ex. Swiper.js)
Hey CJ. Thanks so much for making this open source. I was curious if you know of an easy way to make the mouse event trigger for left or right scrolls only? I’d like for the user to be able to scroll the slider horizontally, but keep the up and down scrolling normal. Thanks again!