Element.cumulativeOffset - Prototype JavaScript 框架

Xunxin Prototype API

cumulativeOffset
1.6

cumulativeOffset(element) -> [Number, Number] 或 { left: Number, top: Number }

返回 element 相对于页面左上角的坐标。
译注:假定返回值为 offset,则 X 轴坐标可通过 offset[0] 获取,也可以通过 offset.left 获取,Y 轴坐标可通过 offset[1] 获取,也可通过 offset.top 获取。

累加元素及它的所有先代节点的 offsetLeftoffsetTop

注意:所有返回值都仅有数字,单位为像素。