This is what i am trying to accomplish: when the last slide is reached fadeOut last slide and then fadeIn first slide, and then clearInterval (everything works with th
Solution for timer which counts 15 sec then goes to main page, if there is click on screen resets timer to the start. It may be useful to someone. (x is counter for touch events) :
var productInterval = null;
var counterForGoToMainPage = 15;
function startTimer(){
counterForGoToMainPage--;
if(counterForGoToMainPage == 0){
clearInterval(productInterval);
counterForGoToMainPage = 15;
window.location.href = "/";
}
}
function countTouches(event) {
var x = event.touches.length;
if(x == 1) {
clearInterval(productInterval);
counterForGoToMainPage = 15;
productInterval = setInterval(function(){
startTimer();
},1000);
}
}