I'm using a jquery api that rotates the images but I have a question about how to stop a setInterval with the hover function of javascript when hovering over the content the interval is executed but I need to remove the mouse interval stop I do not know how to stop it hopefully and you can help me here my code
this is the image that rotates with the interval
<img id="sincroimg" src="img/flechas-actualizar.png" width="30px" height="30px">
and this is my js file
$(document).ready(function(){
$("#sincroimg").hover(function(){
var angle = 0;//definimos la variable angle igual a 0
var inter=setInterval(function(){
angle+=3;
$("#sincroimg").rotate(angle);
},1);
},function(){
clearInterval(inter);
})
})
when executing this code what it does is that the image begins to rotate well but when removing the maouse it does not stop and when I pass the mouse over again what it does is that it rotates more and more and faster some help for please