Skip to content

Instantly share code, notes, and snippets.

@dsebao
Created October 28, 2013 13:46
Show Gist options
  • Save dsebao/7197078 to your computer and use it in GitHub Desktop.
Save dsebao/7197078 to your computer and use it in GitHub Desktop.
Tooltip with jquery
$('.addtooltip').each(function() {
var title = $(this).attr('title');
$(this).data('tipText', title).removeAttr('title');
}).hover(function(){
$('<p class="tooltipx"></p>').text($(this).data('tipText')).appendTo('body').fadeIn('slow');
}, function() {
$('.tooltipx').remove();
}).mousemove(function(e) {
var mousex = e.pageX + 20;
var mousey = e.pageY + 25;
$('.tooltipx').css({ top: mousey, left: mousex })
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment