Created
March 25, 2013 12:13
-
-
Save megaxorg/5236729 to your computer and use it in GitHub Desktop.
<a href="#" class="tooltip" title="Content of the tooltip">
Style with #tooltip
This file contains 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
function tooltip(obj) { | |
if (!obj.length) return; | |
$("body").append('<div id="tooltip" />'); | |
var tooltip = $("#tooltip"); | |
var title; | |
obj.hover(function() { | |
title = $(this).attr("title") ? $(this).attr("title") : "No Title"; | |
$(this).attr("title",""); | |
tooltip.html(title); | |
tooltip.stop(true,true).delay(50).fadeIn("slow").dequeue(); | |
},function() { | |
$(this).attr("title",title); | |
tooltip.stop(true,true).fadeOut("slow"); | |
}).mousemove(function(e) { | |
tooltip.animate({ | |
top:e.pageY + 10, | |
left:e.pageX + 10 | |
},200); | |
}); | |
} | |
jQuery(document).ready(function(){ | |
tooltip($(".tooltip")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment