首页 > Windows开发 > 详细

$(document).height 与$(window).height的区别

时间:2017-08-26 11:15:31      阅读:309      评论:0      收藏:0      [点我收藏+]

$(document).scrollTop() 获取垂直滚动的距离 (即当前滚动的地方的窗口顶端到整个页面顶端的距离)
$(document).scrollLeft() 这是获取水平滚动条的距离

 

要获取顶端 只需要获取到scrollTop()==0的时候 就是顶端了

要获取底端 只要获取scrollTop()>=$(document).height()-$(window).height()
就可以知道已经滚动到底端了

 

注意:$(window).height()  和  $(document).height()的区别

jQuery(window).height()代表了当前可见区域的大小,
jQuery(document).height()则代表了整个文档的高度,可视具体情况使用.

注意:当浏览器窗口大小改变时(如最大化或拉大窗口后) ,
jQuery(window).height() 随之改变,但是
jQuery(document).height()是不变的。

$(document).height 与$(window).height的区别

原文:http://www.cnblogs.com/shouzi/p/7434716.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!