tags:

views:

33

answers:

1

Hey, how can i follow the cursor with a DIV (with jquery)?

kind reagards Peter

+5  A: 

You can't follow the cursor with a DIV, but you can draw a DIV when moving the cursor!

$(document).bind('mousemove', function(e){
    $('#your_div_id').css({
       left:  e.pageX,
       top:   e.pageY
    });
});

That div must be off the float, so position: absolute should be set.

jAndy
+1 and demo http://jsfiddle.net/hj57k/
Reigel
@Reigel - your demo is better than [mine](http://jsfiddle.net/SnJ92/) :)
sje397