Add Next and Prev buttons to a draggable slider in GSAP Posted January 4 On 3/29/2023 at 8:01 PM, FLYPILOT said: Hi guys, thanks for all the help, however I've found a simple solution using the first example: prevButton.addEventListener("click", function(e) { if(slideIndex >= 2) { slideIndex = 1 } baseTl.tweenFromTo(slideIndex, slideIndex += 0.25, {immediateRender: true, duration: 1, ease: "power1.inOut"}) }) nextButton.addEventListener("click", function(e) { if(slideIndex <= 0.75) { slideIndex = 1.75 } baseTl.tweenFromTo(slideIndex, slideIndex -= 0.25, {immediateRender: true, duration: 1, ease: "power1.inOut"}) }) this maybe not the optimized solution, but is currently working for 4 items, I think I do need to find a better solution though. But about the error, I've registered all plugins, and I just did a simple copy and paste code. Hello Flypilot, can I ask you where and how you defined the variable "slideIndex"? Thanks!
Add Next and Prev buttons to a draggable slider
in GSAP
Posted
Hello Flypilot, can I ask you where and how you defined the variable "slideIndex"?
Thanks!