javascript 获取html元素的绝对位置...
时间:2010-08-14 来源:baoeni
有时候我们需要知道HTML元素的觉得位置,用ele.offsetTop和ele.offsetLeft只能得到相对位置,这时可以用oElm.getBoundingClientRect
http://msdn.microsoft.com/en-us/library/ms536433%28VS.85%29.aspx
https://developer.mozilla.org/en/DOM/element.getBoundingClientRect
http://www.quirksmode.org/dom/w3c_cssom.html
Returns a TextRectangle object. Each rectangle has four integer properties (top, left, right, and bottom)
that represent a coordinate of the rectangle, in pixels.
the browser calculates all rectangles (see below getClientRects()), and getBoundingClientRect() returns the lowest (top, left) or highest (bottom, right) values found.
相关阅读 更多 +
- 系统休眠文件删除后果 如何删除计算机的休眠文件 2025-04-22
- 站群服务器是什么意思 站群服务器的作用 站群服务器和普通服务器的区别 2025-04-22
- jQuery插件有何作用 jQuery插件的使用方法 2025-04-22
- jQuery插件有哪些种类 简单的jQuery插件实例 2025-04-22
-