Ok, so I have a very simple gallery right now. It has a next and previous working buttons, and I have it loop every couple seconds. The only problem I have is that when I click next or previous it doesn't continue the loop after I hit next again.
Here are the two snippets of code.
andCode:$('#slideshow .arrow').click(function(){ var li = slides.eq(current), canvas = li.find('canvas'), nextIndex = 0; // Depending on whether this is the next or previous // arrow, calculate the index of the next slide accordingly. if($(this).hasClass('next')){ nextIndex = current >= slides.length-1 ? 0 : current+1; } if($(this).hasClass('previous')){ nextIndex = current <= 0 ? slides.length-1 : current-1; }
I've been trying to figure this out without posting on the forums, but I am stumped.Code:$(window).load(function(){ // The window.load event guarantees that // all the images are loaded before the // auto-advance begins. var timeOut = null; $('#slideshow .arrow').click(function(e,simulated){ // The simulated parameter is set by the // trigger method. if(!simulated){ // A real click occured. Cancel the // auto advance animation. clearTimeout(timeOut); } }); (function autoAdvance(){ // Simulating a click on the next arrow. $('#slideshow .next').trigger('click',[true]); // Schedulling a time out in 5 seconds. timeOut = setTimeout(autoAdvance,1000); })(); });
Thanks for the help
This is the tutorial I followed.
http://tutorialzine.com/2010/09/html...deshow-jquery/


Reply With Quote
Bookmarks