Skip to main content
edited tags; edited tags
Link
200_success
  • 145.7k
  • 22
  • 191
  • 481
Source Link

Compact jQuery tool tip code, without jQueryUI

I have this tooltip code that I came up with, using jQuery:

$('div.a')
.bind('mousemove', function(e){
    $('#follow').css({
       left:  e.pageX + 20,
       top:   e.pageY
    });
})
.mouseenter(function() {
    $('#follow').css('display','block');
})
.mouseleave(function() {
    $('#follow').css('display','none');
})

I was wondering if there is anyway to compact it even more than it already is (ignore whitespace).

Here is a jsFiddle, if you'd like to test it.