Home › Forums › JavaScript › [Solved] Help with simple setTimeout() issue › Re: [Solved] Help with simple setTimeout() issue
January 20, 2011 at 3:29 pm
#65099
Member
I struggled with that for a while.
Here’s what I’m busy doing in PlusSlider.
// Define functions
clearTimer = function () {
// Clear the timer if it is set
if (timer) {
window.clearInterval(timer);
}
}
beginTimer = function () {
timer = window.setInterval(function () {
nextSlide();
}, 2000);
}
beginTimer();
// Pause on hover
$(this).hover(function () {
clearTimer();
}, function () {
beginTimer();
});