天天看点

offsetX各种值总结

转个笔记,原文链接:

offsetX各种值总结

pageX: 页面X坐标位置

pageY: 页面Y坐标位置

screenX: 屏幕X坐标位置

screenY: 屏幕Y坐标位置

clientX: 鼠标的坐标到页面左侧的距离

clientY: 鼠标的坐标到页面顶部的距离

clientWidth:可视区域的宽度

clientHeight:可视区域的高度

offsetX:鼠标坐标到元素的左侧的距离

offsetY:鼠标坐标到元素的顶部的距离

offsetLeft: 该元素外边框距离包含元素内边框左侧的距离

offsetTop:该元素外边框距离包含元素内边框顶部的距离

offsetWidth: width + padding-left + padding-right + border-left + border-right

offsetHeight: height + padding-top + padding-bottom + border-top + border-bottom

offsetParent: 包含元素

可以通过定位改变包含元素

作者:那麽快樂

链接:https://www.jianshu.com/p/c0eae5eed0e9

来源:简书

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

继续阅读