I have a problem that i will not be able to solve by myself. I want to show a countdown timer once they hover over a photo. It works the first time you hover. If you move the mouse and hover again it will just be weird numbers jumping. I hope someone can help me with this!
Best Regards,
Tassilo
<script>
$('.Photo').on({
'mouseover': function () {
var timer = 5;
var interval = setInterval(function() {
timer--;
$('.timer').text(timer);
if (timer === 0) clearInterval(interval);
}, 1000);
},
'mouseout' : function () {
clearTimeout(timer);
}
});
</script>