I'm trying to make an infinite image carousel that will be part of a rich-media banner ad. The idea is to have the images infinite scroll in both directions with user controls for Next and Previous. The area marked in red would be visible area of the ad.
I leveraged the pen from the Modifiers plugin. I got the Next button to work, but the Previous button is not quite as I expected. The Previous moves all the "box" divs to the left (as it should), but they end up outside the red area.
Thanks for the demo.
This is a little bit tricky and something similar had me stumped awhile ago.
Thankfully, @OSUblake shared his ModifiersPlugin Helper Functions post awhile ago.
In there he has a wrap() function that supports a negative minimum value.
wrap(500, -100, 500); // => -100
function wrap(value, min, max) {
var v = value - min;
var r = max - min;
return ((r + v % r) % r) + min;
}
So to make your demo work in both directions you need to w