Created
March 4, 2011 14:52
-
-
Save tempredirect/854708 to your computer and use it in GitHub Desktop.
Hacky plugin to allow removal of the tooltips created by jquery tools tooltip
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
/** | |
* hacky plugin to allow removal of the jquery tools tooltip objects. | |
* | |
* Doesn't pay any attention to the special event configuration, and will blindly unbind all | |
* mouse[enter|leave] listeners from the trigger element. | |
*/ | |
(function($){ | |
var tooltip = $.fn.tooltip, | |
slice = Array.prototype.slice; | |
function removeTooltip($elements){ | |
$elements.each(function(){ | |
var $element = $(this), | |
api = $element.data("tooltip"), | |
tip = api.getTip(), | |
trigger = api.getTrigger(); | |
api.hide(); | |
if( tip ){ | |
tip.remove(); | |
} | |
trigger.unbind('mouseenter mouseleave'); | |
}); | |
} | |
$.fn.tooltip = function(p){ | |
if( p === 'remove'){ | |
removeTooltip(this); | |
return this; | |
} else { | |
return tooltip.apply(this, slice.call(arguments,0)); | |
} | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment