jquery获取html元素位置

来源:互联网 发布:普联软件 怎么样 编辑:程序博客网 时间:2024/04/30 04:34

jquery获取HTML元素位置


//Get the current coordinates of the first element, or set the coordinates of every element, in the set of matched elements, relative to the document.//获取匹配元素在当前视口的相对偏移$("#id").offset().left;$("#id").offset().top;//Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.//获取匹配元素相对父元素的偏移$("#id").position().left;$("#id").position().top;




原创粉丝点击