So I\'m trying to build an animating background image which will cycle through an array of images.
The idea is also that when you click any navigation element on th
This should do it for you.
var IntID = setTimer();
function setTimer(){
i = setInterval(startSlider, 4000);
return i;
}
function stopSlider() {
clearInterval(IntID);
}
//Restart Timer
// Option 1 make a restartSlider function and call it
$("#home").click(restartSlider);
function restartSlider(){
IntID = setTimer();
}
//Option 2 create an anonymous function only for that click event.
$("#home").click(function(){
IntID = setTimer();
});