Search code examples
javascriptiscroll4

iScroll4 - all Next / Prev buttons controlling bottom Carousel - JS Fiddle


I've created a JSFiddle for my problem, but for some bizarre reason, even tho I've precisely placed working online example into this JSFiddle jsfiddle.net/r9VL2/1/ - it's not working?

Can anyone get it working like my online example 'Carousel within Simple Vertical Scrolller', that would be good for starters :)

But my actual problem as you can see here 'Carousel within Simple Vertical Scrolller' is that the Prev and Next buttons all control the last carousel.

Can anyone help me slim down the javascript and get it so the Prev and Next Buttons work for there parent carousel, instead of just all controlling the last carousel.

Any pro help would be awesome thanks.

Josh

Scan code below to test on your device.

QR CODE


Solution

  • You are using the same variable multiple times - thats not going to work - if you create a separate variable for each section / scroll then it works fine -> http://jsfiddle.net/manseuk/r9VL2/2/

    Im sure there are better ways to create the variable / keep track of what scroll should be used when