Reputation: 1322
I'm doing a webpage with a slideshow, with a jQuery scrollLeft function
.
My problem is that it works on the first .slide
then the div scrolls to a completely wrong position.
Note that I'm using the function on two different classes!
Here's a jsfiddle of my problem: https://jsfiddle.net/5xx6g7j8/
Any ideas?
Upvotes: 0
Views: 375
Reputation: 773
I update your jsfiddle. -> https://jsfiddle.net/5xx6g7j8/1/
$('#slideShow').stop().animate({
scrollLeft: Math.abs($('#slideWrap').offset().left) + $($anchor.attr('href')).offset().left
}, 1500);
I think now works properly. You just had to take care about the current offset of the container before start the animation.
I hope it helps.
EDIT: I see now that I forgot an alert. Sorry
Upvotes: 1