tags:

views:

63

answers:

3

How can I use Javascript to display the information message next to the mouse pointer when the mouse pointer hovers over a link or button? The information will always be next to the mouse pointer until the mouse moves out of the link/button.

A: 

With jQuery, you would use the following methods:

Should be relatively clear how to stitch those together.

wombleton
+1  A: 

Yes this is possible. Look at the onmousemove event handling function. It is passed an event object which holds properties called clientX and clientY, which are the mouse coordinates.

Of course, IE does this sort of thing slightly differently and will be a pain for you. A Javascript library glosses over these differences and would be easier, but it's not too hard to do it in plain JS.

nickf
A: 

Jin, Overlib is exactly what you are looking for, and if you got that idea from another website, chances are, that site was using it. The tip/info is always present when hovering over an enabled element - which is overLib's default behavior. It's also easily customisable to one of the many examples on the home page:

http://www.bosrup.com/web/overlib/

karim79