Code:
<script>
$("#imovel1").mouseenter(function(){
var rel = 1;
var changer = setInterval(function(){
for(i = 1; i <= 5; i++){
$(this).find('img[relimg='+i+']').hide();
}
rel = rel + 1;
if (rel > 5) { rel = 1; }
$(this).find('img[relimg='+rel+']').show();
}, 1500);
}).mouseleave(function(){
clearInterval(changer);
});
</script>
Cant figute out why this code isnt working.
Appreciate if someone could help me.
PS: The mouseenter and mouseleave is working. But the setInterval isnt. Thanks!