Home > Article > Web Front-end > HTML gets the position of the current tag on the page and displays other floating windows_html/css_WEB-ITnose
//event--event object
//ele current label
function hover(event, ele) {
var t, l, a, b;
a = ele;
t = a.offsetTop;
l = a.offsetLeft;
while (a.tagName != "BODY") {
a = a.offsetParent;
t a.offsetTop;
l = l a.offsetLeft;
}
var x = (parseInt(l) - 200) " px";
var y = (parseInt( t) - 200) "px"; //The position of the current label
$(ele).prev().prev().show();
$(ele).prev().prev() .css("top", y);
$(ele).prev().prev().css("left", x);
$(ele).prev().prev() .css("width", "210px");
}