关于offsetWidth、clientWidth与scrollWidth

三大系列对比

图示

他们的主要用法:

1. offset系列经常用于获得元素位置 offsetLeft    offsetTop;

2. client经常用于获取元素大小 clientWidth      clientHeight;

3. scroll经常用于获取滚动距离 scrollTop     scrollLeft;

4.注意页面的滚动距离通过 window.pageXOffset 获得。

posted on 2020-06-05 16:47  SailorM  阅读(205)  评论(0编辑  收藏  举报