Wednesday, January 11, 2012

Restarting from beginning after clearInterval


link to test site



I want to restart the animation from the beginning once it stops at the last image. I tried the code below but it won't return to the first image.




$(document).ready(function () {
window.setInterval("slideshow()", 3000);
});

function slideshow() {
var time = window.setInterval("slideshow()", 3000);
next = $(".next");
inside = parseInt($(".inside").css("left"));

if (inside == -3080) {
window.clearInterval(time);
inside == 0;
}
else {
next.trigger("click");
}
}

No comments:

Post a Comment