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
Here is utility object that takes a callback and interval which you can use to start and stop an interval.
//simple utility object to start and stop an interval
var IntervalUtil = function(functionCall, interval){
var intervalObj = 0,
INTERVAL = interval;
var callback = functionCall;
function startTimer(){
console.log('start timer', intervalObj)
if(intervalObj === 0){
intervalObj = setInterval(callback, INTERVAL)
}
}
function stopTimer(){
clearInterval(intervalObj);
intervalObj = 0;
console.log('timer stopped', intervalObj);
}
return {
startTimer : startTimer,
stopTimer : stopTimer
}
};
*You would use it like so *
Timer : setInterval()