JS中height、clientHeight、scrollHeight、offsetHeight区别



$(window).height();//是文档窗口高度
$("div").offset().top//是标签距离顶部高度
$(document).scrollTop();//是滚动条高度
$("div").height();//是标签高度
你要的高度+$("div").height()+[$("div").offset().top-$(document).scrollTop()]=$(window).height();

经过简单的数学变换即可得到你要的值了

猜你喜欢

转载自blog.csdn.net/weixin_41017246/article/details/80932143
今日推荐