I tried $.unbind('hover'),which is not working
+5
A:
The hover function it's just a short-hand to bind two handlers to the mouseenter and mouseleave events, you should unbind them:
$('#item').unbind('mouseenter mouseleave');
CMS
2009-10-13 05:43:58
You can combine those calls: `.unbind('mouseover mouseout');`
nickf
2009-10-13 05:47:01
Thanks @nickf, edited to add your recommendation.
CMS
2009-10-13 05:49:06
It still doesn't work
Mask
2009-10-13 05:49:45
Is it because the listener is added by $.hover(),not by $.bind()?
Mask
2009-10-13 05:50:54
@Mask, take a look to this example: http://jsbin.com/ibine
CMS
2009-10-13 05:58:43
i have added the listener by .hover() and it removed fine by .unbind()
takpar
2010-05-11 17:51:18
A:
You could also try:
$('#item').bind('hover', function(){return false})
cam8001
2009-10-13 05:52:01
Binding extra event handlers to an object does not override previously bound handlers. This may well work, since the `return false` may stop the propagation, but it's not a great solution.
nickf
2009-10-13 06:05:38