Skip to content

Instantly share code, notes, and snippets.

@zbabtkis
Created May 20, 2013 16:24
Show Gist options
  • Save zbabtkis/5613384 to your computer and use it in GitHub Desktop.
Save zbabtkis/5613384 to your computer and use it in GitHub Desktop.
Better jQuery ToolTip -- Simple and works in Firefox!
$.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