jquery获取各种高度

  • Post author:
  • Post category:其他


1、获取屏幕高度

     $(window).height()     浏览器当前窗口可视区域高度
     $(document).height()   浏览器当前窗口文档的高度
     $(document.body).height()  浏览器当前窗口文档 body 的高度
     $(document.body).outerHeight(true)   文档body 的总高度 (border padding margin)

2、屏幕滚动高度

     $(document).scrollTop

3、获取容器到距离顶部的高度

      document.getElementById(str).getBoundingClientRect().top



版权声明:本文为Yangli_nn原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。