Created
May 20, 2013 16:24
-
-
Save zbabtkis/5613384 to your computer and use it in GitHub Desktop.
Better jQuery ToolTip -- Simple and works in Firefox!
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
$.fn.betterTip = function() { | |
var that = this; | |
function getTip() { | |
var tip = $('<div />', {'class': 'tooltip'}); | |
tip.html($(this).attr('title')); | |
tip.css({ | |
'position': 'absolute', | |
'marginTop': '-30px' | |
}); | |
return tip; | |
} | |
function showTip() { | |
$(this).before(getTip.apply(this)); | |
} | |
function hideTip() { | |
$('.tooltip').remove(); | |
} | |
this.bind('mouseover', showTip); | |
this.bind('mouseout', hideTip); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment