@Jarolin What makes it difficult to give you an answer is that slides are traditionally within a container and that container is positioned instead of the slides themselves, if you want to float the slides.
What the demo above does is position each slide separately. And also, because the slides aren’t wrapped, you can’t for example have 10 slides in a row, because extra slides would either wrap to the next line or make the document extend beyond the browser window (scroll bar to the right).
More traditional markup with overflow hidden would allow for that, [something like this](http://codepen.io/Mottie/pen/aunjE):
> What makes it difficult to give you an answer is that slides are traditionally within a container and that container is positioned instead of the slides themselves
I would however keep track of the current index and for example go to left only `if (index > 0)` and go to right only `if (index < $('.field').length - 1)` or something (length from a var, this is just an example). You can then slide to that field using the same jQuery as I used here: http://codepen.io/CrocoDillon/pen/lozFt
@mottie, your implementation comparing the position fails if you click the next button repeatedly, that’s why I like comparing to something that doesn’t change during the animation.
@mottie Thank’s for all your help. I applied the Jquery and it’s working great. http://reallycoolstuff.net/PROJECTS/Unica/index.html Although there is one problem. When i zoom out and navigate through the slides it delocates. and things get alittle weird. Is there a solution to this problem?
It looks like the width of the slides are 1285px but the container is set to 95%… that’s why there is an inconsistency.
Now you see why it’s easier to use a plugin instead of writing your own.
To fix it you’ll need to get the window size and change the width of all of the slides, then bind to the window resize event, but make sure it is throttled, to re-adjust the slide sizes.
It appears to be a bug with jQuery animate only in Chrome: http://bugs.jquery.com/ticket/5565 … you can try to use jQuery just to set the `left` (and don’t use something like `left += width`, but keep a var keeping the current left value yourself) and use CSS transitions to handle the animation.
You must be logged in to reply to this topic.