I have the following code
var inter = setInterval(function(){
plusDivs(1);
}, 2500);
$(".mySlides").mouseenter(function(){
clearInterval(inter);
});
$(".mySlides").mouseleave(function(){
var inter = setInterval(function(){
plusDivs(1);
}, 2500);
console.log(inter);
});
In the above code, the inter
variable is supposed to be a loop that stops when the cursor enters div
. When I reload the page, the loop starts fine, when I move the cursor over, how it should be, how much I remove the div cursor, it starts but after it passes again, it does not stop and it retreats again, 2 loops start at the same time.
The slideshow was based here