Created
April 11, 2014 11:06
-
-
Save pherrymason/10458877 to your computer and use it in GitHub Desktop.
Unbind jQuery HoverIntent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rawIntent = $.fn.hoverIntent; | |
$.fn.hoverIntent = function(handlerIn, handlerOut, selector){ | |
var args = arguments; | |
return this.each(function(){ | |
// If called with empty parameter list, disable hoverIntent | |
if( typeof handlerIn==='undefined' ) | |
{ | |
// Destroy the time if it is present | |
if( typeof(this.hoverIntent_t!=='undefined') ) | |
{ | |
this.hoverIntent_t = clearTimeout(this.hoverIntent_t); | |
} | |
// Cleanup all hoverIntent properties on the object | |
delete this.hoverIntent_t; | |
delete this.hoverIntent_s; | |
//Unbind all of the hoverIntent event handlers. | |
$(this).off('mousemove.hoverIntent,mouseenter.hoverIntent,mouseleave.hoverIntent'); | |
} | |
else | |
{ | |
rawIntent.apply( $(this), args); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment