For this "photo image" slider, I'm almost there: http://jsfiddle.net/4z4Lok9y/1/
When I get to slide 3 and hit "next" I would like it to return to slide 1. (Without the jumping through slide 2, the "jerky motion).
Same for when I'm on slide 1 and hit "prev" I would like to go to slide 3 without the jumping around.
What is the minimal, easiest way to fix my jsfiddle for this motion?
$(document).ready(function(){
var slides = $('.js-slide');
var i = 0;
$('.navigation a.nav-right').click(function(){
i = ++i % slides.length;
$('.slide-wrapper').animate(
{
'left' : -(slides.eq(i).position().left)},300);
});
$('.navigation a.nav-prev').click(function(){
i = --i % slides.length;
$('.slide-wrapper').animate(
{
'left' : -(slides.eq(i).position().left)},300);
});
});
Thanks,
maybe like this http://jsfiddle.net/4z4Lok9y/2/