jQuery API 返回首页目录 | jQuery API 中英文对照版
offset()

offset()

This returns an object with top, left, width, height, borderLeft, borderTop, marginLeft, marginTop, scrollLeft, scrollTop, pageXOffset, pageYOffset. The top and left values include the scroll offsets but the scrollLeft and scrollTop properties of the returned object are the combined scroll offets of the parent elements (not including the window scroll offsets). This is not the same as the element's scrollTop and scrollLeft. For accurate readings make sure to use pixel values.

返回值

Object

offset(refElement)

This returns an object with top, left, width, height, borderLeft, borderTop, marginLeft, marginTop, scrollLeft, scrollTop, pageXOffset, pageYOffset. The top and left values include the scroll offsets but the scrollLeft and scrollTop properties of the returned object are the combined scroll offets of the parent elements (not including the window scroll offsets). This is not the same as the element's scrollTop and scrollLeft. For accurate readings make sure to use pixel values.

返回值

Object

参数

  • refElement (String): This is an expression. The offset returned will be relative to the first matched element.

offset(refElement)

This returns an object with top, left, width, height, borderLeft, borderTop, marginLeft, marginTop, scrollLeft, scrollTop, pageXOffset, pageYOffset. The top and left values include the scroll offsets but the scrollLeft and scrollTop properties of the returned object are the combined scroll offets of the parent elements (not including the window scroll offsets). This is not the same as the element's scrollTop and scrollLeft. For accurate readings make sure to use pixel values.

返回值

Object

参数

  • refElement (jQuery): The offset returned will be relative to the first matched element.

offset(refElement)

This returns an object with top, left, width, height, borderLeft, borderTop, marginLeft, marginTop, scrollLeft, scrollTop, pageXOffset, pageYOffset. The top and left values include the scroll offsets but the scrollLeft and scrollTop properties of the returned object are the combined scroll offets of the parent elements (not including the window scroll offsets). This is not the same as the element's scrollTop and scrollLeft. For accurate readings make sure to use pixel values.

返回值

Object

参数

  • refElement (HTMLElement): The offset returned will be relative to this element.

 

相关链接
asp之家 | jQuery官方网站 | jQuery中文网 | 电子书作者网站 | 电子书作者blog