Is it possible to trigger a hoverIntent on an element.
I have tried $(elem).trigger('hoverIntent');, which didn't work.
Edit: Js Fiddle: http://jsfiddle.net/H2p6T/
Simply triggering any of the event types did nothing unless the hoverIntent had been triggered genuinely.
I took a look at the hoverIntent source and it expects two things: mouseenter and mousemove with pointer coordinates defined. So I triggered events with fake coordinates:
$('.foo').trigger({ type:"mouseenter", pageX:"123", pageY:"123" });
$('.foo').trigger({ type:"mousemove", pageX:"123", pageY:"123" });
The coordinates don't matter as long as they are close enough to each other to trigger hoverIntent.
I used the r7 version for this.
Have you tried
$(elem).trigger('hover');
or
$(elem).trigger('mouseover');
$(elem).trigger('mouseout');
or
$(elem).trigger('mouseenter');
$(elem).trigger('mouseleave');
hoverIntent is a plugin not an actual event so I believe you have to trigger an event that hoverIntent actually binds to your element
Here's an example of it working with the mouseenter/mouseleave
http://jsfiddle.net/H2p6T/3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With