5
Hello, I have the following code (just studying):
$('#test').hover(function(){
$('.box-one, .box-two, .box-three').hide();
$(this).removeClass('test').addClass('another-test').stop().animate({'height':'210px'});
$('.my-message').fadeIn();
}, function(){
$('.box-one, .box-two, .box-three').fadeIn();
$(this).removeClass('another-test').stop().animate({'height':'110px'}).addClass('test');
$('.my-message').fadeOut();
});
When hovering the mouse over the element, I should expect something around 0,400 seconds until the function activates, but if I give up or simply passed the mouse by mistake, the function must recognize that the mouse is no longer on top of the element and with this must cancel what would be done...
The passage of own to "within" the timer is in fact something critical in these implementations +1 I didn’t remember that!
– Zuul
I believe that this answer has two problems. One would be the use of
setInterval
, that defines a timer that runs several times, not just once. Another problem occurs that the output action will always occur when the cursor is removed from above the element#test
, even before 400 ms.– Tasso Evangelista