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

HTML gets the position of the current tag on the page and displays other floating windows_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:52:561341browse

//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");
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn