javascript - jQuery slider infinite scrolling not working -
i'm trying create simple infinite scrolling jquery slider. problem after reaching 3rd image, slider goes first, going through other images.
here code: jsfiddle
$('#rightarrow').click(function() { currentposition = currentposition+1; slidercontrols(currentposition); $('#combined').animate({ 'marginleft' : slidewidth*(-currentposition) }); });
i want make infinite cycle. after 3rd image should first same animation.
creating infinite cycle not easy might think. create infinite slider, have append new elements @ end of slider, when reaches end. items append @ end can removed front best performance.
as there many infinite scroll plugins around, might want try one: http://megahitmag.com/free-infinite-scrolling-jquery-plugins/
Comments
Post a Comment