- A+
所属分类:JQuery/Js
javascript:
可视区域宽 :
document.documentElement.clientWidth (width + padding)
可视区域高 :
document.documentElement.clientHeight (height + padding)
可视区域宽:
document.body.offsetWidth (包括边线的宽: width + padding + border)
可视区域高:
document.body.offsetHeight (包括边线的高:height + padding + border)
内容高 :
document.body.scrollHeight
文档高 :
document.body.offsetHeight
纵向滚动的距离 :
document.body.scrollTop || document.documentElement.scrollTop
横向滚动的距离 :
document.body.scrollLeft || document.documentElement.scrollLeft
jquery:
可视区域宽 :
$(window).width()
可视区域高 :
$(window).height()
页面的文档宽 :
$(document).width();
页面的文档高 :
$(document).height();
获取滚动条到左边的垂直宽度 :
$(document).scrollLeft();
获取滚动条到顶部的垂直高度 :
$(document).scrollTop();