Share Posted January 24, 2021 Hey y'all! I'm messing around with this horizontal scrolling demo where I'm using ScrollTrigger and setting the body width to an excessive width. The effect works as expected when scrolling (I've not styled things up yet, POC 😅). But, I want to add "Next/Previous" buttons to the UI and I can't see what obvious thing I'm missing 🤦♂️ "Previous" works as expected. But, "Next" is never able to reach the last item. I'm assuming I'm not doing something quite right in `SCROLLER.scroll` at Line ~#150. Or, my `start` and `end` isn't quite right? Could even be how I'm determing which item is the "Current" one. For that, I'm using `Math.floor(mapRange(0, 1, 0, CARDS.length, self.progress))`. And the snap "seems" to work. Anyone able to point out what obvious thing I'm missing? 🙏😅 See the Pen 9087b98b088d025b16fc50aff45ba9f1 by jh3y (@jh3y) on CodePen Link to comment Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!Register a new account
Already have an account? Sign in here.Sign In Now