I have a list of customer records (tr in a table) in my app.
When the user hovers their mouse over a record (tr), I want to show a div which hovers over the other records and shows more detailed information about the record.
I want the div to then move开发者_开发问答 with the mouse- i.e. if they move the mouse 20 pixels to the right so they can see a different field on the record (the tr), the now unhidden div should then move 20 pixels to the right to follow the cursor.
Is this do-able with Javascript/CSS?
Yes. Do the visible/invisible part with the CSS property visiblility:visible/hidden
, set position
to absolute
and then assign values to top
(y-coordinate) and left
(x-coordinate) on mousemove
elements.
Very possible, they're called "Tooltips" which there are probably a vast array of them out there. Looks like there's one here that is lightweight and does what you want.
If you're using a framework (jQuery/prototype/mootools etc), then there will most likely be plugins that will do this too.
For a prepackaged jquery solution: http://jquery.bassistance.de/tooltip/demo/.
Check out the example that has tracking on.
精彩评论