Fire Slow Hang Event with jQuery

I am trying to trigger a hover delay event:

$(".graphic").delay(500).trigger('mouseover').trigger('mouseout');

But the delay is ignored.

Any ideas?

+5
source share
3 answers

delay () only affects the animation queue, but trigger () is synchronous. You can use queue () to schedule a function that fires events after a delay:

$(".graphic").delay(500).queue(function(next) {
    $(this).trigger("mouseover").trigger("mouseout");
    next();
});
+8
source

The method is .delay()best to delay between jQuery parameters in the queue .

, setTimeout(). , mouseover() trigger('mouseover')

setTimeout(function () {
  $(".graphic").mouseover().mouseout();
}, 500); 
+2

jQuery API :

Only subsequent events in the queue are delayed; for example, this does not delay forms without .show () or .hide () arguments that do not use the effects queue.

Perhaps you can set a timer that will start mouseover / out in 500 ms using Windows.setTimeout

+2
source

All Articles