have a custom made slider which I would like to stop on hover. I've tried to clear and set the interval on hover but doesn't work properly. It stops only the first time I hover on it then if I move the mouse out and in again it doesn't stop.
here's my code:
var itvl = null;
itvl = window.setInterval(function(){scroll_()},3000);
function scroll_() {
if ($('#carousel_ul li').length > 1) {
$("#right_scroll").click();
}
}
$('#carousel_ul li').hover(function() {
window.clearInterval(itvl);
}, function() {
window.setInterval(function(){scroll_()},3000);
});
Any idea what am I doing wrong?
Thanks in advance
Mauro