JavaScript-scroll

scroll

scrollWidth / scrollHeight

  • 当内容宽度/高度没有超过 content 时:scrollWidth / scrollHeight = content + padding = clientWidth / clientHeight
  • 当内容宽度/高度超过 content 时:scrollWidth / scrollHeight = content + padding + 内容超出部分的宽高

scrollTop / scrollLeft

scrollTop/scrollLeft:元素滚出可视区域的宽高(从超出内边距的部分开始)

原文地址:https://www.cnblogs.com/luwenfeng/p/11694778.html