train of Thought:
1. First of all to locate the elements to achieve this effect, this time through class
2. If the dynamic display of different content, you need to set the title
3. JQ to Elements plus mouseover and mouseout events
4. Again, the popup box follows the mouse and moves on the target element.
5. Then combine mouseover and mouseout into hover
Copy Code code as follows:
Page load Complete
$ (function () {
var x = 10;
var y = 20; Set the Tip box relative to the offset position to prevent occlusion of the mouse
$ (". Prompt"). Hover (function (e) {//mouse over events
This.mytitle = This.title; Assign the title to the custom attribute Mytilte, and shield yourself with hints
This.title = "";
var tooltiphtml = "<div id= ' tooltip ' >" + this.mytitle + "</div>"; Create a hint box
$ ("Body"). Append (tooltiphtml); Add to Page
$ ("#tooltip"). CSS ({
"Top": (E.pagey + y) + "px",
"Left": (E.pagex + x) + "px"
). Show ("Fast"); Sets the coordinates of the prompt box and displays
}, function () {//Mouse out event
This.title = This.mytitle; Reset Title
$ ("#tooltip"). Remove (); Remove Pop-up Box
}). MouseMove (function (e) {//Follow mouse move event
$ ("#toolti"). CSS ({"Top": (E.pagey + y) + "px",
"Left": (E.pagex + x) + "px"
});
});
});