Ideas:
1. First, you need to locate the elements that implement this effect.
2. If different prompts are dynamically displayed, you need to set the title
3. Add the mouseover and mouseout events to the located element through JQ.
4. Complete the settings and move the mouse on the target element.
5. Merge mouseover and mouseout into hover.
Copy codeThe Code is as follows:
// Page loaded
$ (Function (){
Var x = 10;
Var y = 20; // sets the offset position of the prompt box to prevent the mouse from being blocked.
$ (". Prompt"). hover (function (e) {// move the cursor over event
This. myTitle = this. title; // assign the title to the custom attribute myTilte, shielding the built-in prompt
This. title = "";
Var tooltipHtml = "<div id = 'tooltip '>" + this. myTitle + "</div>"; // create a prompt 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 removal event
This. title = this. myTitle; // reset the title.
$ ("# Tooltip"). remove (); // The remove dialog box appears.
}). Mousemove (function (e) {// move the event following the mouse
$ ("# Toolti" ).css ({"top": (e. pageY + y) + "px ",
"Left": (e. pageX + x) + "px"
});
});
});