JQuery only activates the mouse function if the mouse holds an item

I would like to activate the function .mouseoveronly if the mouse rests on the trigger element for a given duration (for example, 500 milliseconds).

eg.

$('.featured').mouseover(function () {
      $('.feat-txt').fadeOut("fast");
    });

Only if the mouse is positioned above the .featured element for at least 500 milliseconds, the function can start, and .feat-txt - FadeOut. A simple mouse (just a quick move) on this element does not activate the function.

Any suggestion on how to do this?

+5
source share
3 answers

:

  • onmouseover . ; , . Name.delay(500)

  • , , jQuery, . , , .

, , Name - .

, , .

+1

, jquery hover. http://blog.threedubmedia.com/2008/08/eventspecialhover.html

It does not use the length of time the mouse waits, but uses the speed of the mouse over a specific period of time.

The result can be seen in the three rectangles displayed on the right side of this page: http://www.splendida.it (I am currently working on it).

I like it. When the mouse quickly jumps from the first to the third, nothing happens, even if the mouse passes over the second element.

0
source

All Articles