I’m using the hoverIntent jQuery plugin in place of jQuery’s hover() method. I want the mouseout event to be called automatically.
When using hover(), I can trigger the mouseout event by calling mouseout(). This doesn’t work when using hoverIntent.
I also tried calling a named anonymous function, but it didn’t work for me (and I hear older IEs don’t like named anonymous functions).
Here is an example on jsFiddle.
If I auto invoke the mouseout function, it can’t be called via hoverIntent.
Now I know I could do…
$('something').hoverIntent(function() { }, something);
something();
But I was wondering if what I wanted was possible?
Thanks
Unfortunately there’s not a way besides a named function, not with how the plugin is structured…it’s not stored in any way that’s accessible later, only to the plugin’s closure.
It’s set here:
…then after that all references are to that
cfgobject which is only accessible inside the plugin. If you wanted to change the plugin and store thatcfgobject via.data()for example you could, but as-is there’s no way to access or trigger either anonymous handler.