Yes, I know that this question was asked before, but I canโt find an answer that works. This is an accepted answer from one of the other questions:
$('#element').hover(function()
{
$(this).data('timeout', window.setTimeout(function()
{
alert('hovered for 2 seconds');
}, 2000));
},
function()
{
clearTimeout($(this).data('timeout'));
alert('mouse left');
});
http://jsfiddle.net/nCcxt/
As you can see, he is not doing what he should.
I just need it in theory, but I canโt get it to work - when the user clicked on the link for 2 seconds, the function is called. If the user moves the mouse away to the passage after 2 seconds, nothing happens.
jovan source
share