JQuery hover event forwarding (helper)
When the page loads, I call a function that puts the hover event at $ ('a.tooltip'). When I want to cancel this event, I do the following:
$('a.tooltip').unbind('mouseover mouseout');
It works! However, when I want to reset the hover event and I call the function that was first loaded into the document, ready again, it doesn't recheck the hover helper. How can I reconfirm it?
Thank,
Ice
Are you sure the unlock is working correctly? In my experience .hover () does the right setup, but I had to use this incoherent syntax:
$(this).unbind('mouseenter').unbind('mouseleave');
When I tried to put both events in one unbind (), it only unbound one of them.
Wondering what's going on for you? (Or if the choice mouseover
vs mouseenter
etc. matters?)
Update
According to quirksmode.org , mouseenter
and mouseleave
are IE specific events, but as Jimmy pointed out in the comments, jQuery implements them for other browsers as well.
source to share
I found that when I use the bind method things can get a little fussy. You might want to try using the hover (over, out) function as such:
$(this).hover(
function() {
if (okayToHover) { dowhatever; }
},
function() {
if (okayToUnhover) { undowhatever; }
});
I know this is a little cool, but I find the hover feature gives me a little more control over what happens, and for whatever reason, it works a little better. This is only in my experience, though ...
source to share