You should not redeclare same variable (initList) twice. Use an unique name for each interval.
Maybe, this is what you are lookig for:
var initList2, initList1 = setInterval(function () {
if (cache.isAnimating) return false;
cache.isAnimating = true;
aux.navigate(1, $el, $wrapper, settings, cache); //slide
}, 3500);
$(document).ready(function () {
initList2 = setInterval(function () {
if (cache.isAnimating) return false;
cache.isAnimating = true;
aux.navigate(1, $el, $wrapper, settings, cache);
}, 3500);
})
$("div.ca-wrapper").mouseover(function () {
clearInterval(initList1);
clearInterval(initList2);
}).mouseout(function () {
initList2 = setInterval(function () {
if (cache.isAnimating) return false;
cache.isAnimating = true;
aux.navigate(1, $el, $wrapper, settings, cache);
}, 3500);
})
But using your original code, as setInterval returns an integer, you could use this too:
don't use that
quoting Boris Zbarsky
There is no guarantee that setInterval returns consecutive integers (and in fact in some cases it does not), so the "subtract one" approach is not all that great...
var initList = setInterval(function () {
if (cache.isAnimating) return false;
cache.isAnimating = true;
aux.navigate(1, $el, $wrapper, settings, cache); //slide
}, 3500);
$(document).ready(function () {
initList = setInterval(function () {
if (cache.isAnimating) return false;
cache.isAnimating = true;
aux.navigate(1, $el, $wrapper, settings, cache);
}, 3500);
})
$("div.ca-wrapper").mouseover(function () {
clearInterval(initList);
clearInterval(initList - 1); // HERE, we are clearing the previous interval
}).mouseout(function () {
initList = setInterval(function () {
if (cache.isAnimating) return false;
cache.isAnimating = true;
aux.navigate(1, $el, $wrapper, settings, cache);
}, 3500);
})