offsetWidth、offsetHeight、clientWidth、clientHeight、innerWidth、innerHeight、Width()、Height()详解
offsetWidth = width+padding+border
js:var offsetW = document.documentElement.offsetWidth || document.body.offsetWidth;//兼容浏览器
jq:$(‘body’)[0].offsetWidth;
offsetHeight = height+padding+border
js:var offsetH = document.documentElement.offsetHeight || document.body.offsetHeight;//兼容浏览器
jq:$(‘body’)[0].offsetHeight;
clientWidth = width+padding
js:var clientW = document.documentElement.clientWidth || document.body.clientWidth;//兼容浏览器
jq:$(‘body’)[0].clientWidth;
clientHeight = height+padding
js:var clientH = document.documentElement.clientHeight || document.body.clientHeight;//兼容浏览器
jq:$(‘body’)[0].clientHeight;
width() = width+padding 可视屏幕宽,不包括滚动条
$(window).width();
height() = height+padding 可视屏幕高,不包括滚动条
$(window).height();
innerWidth() = width+padding+border+横向滚动条 整个屏幕宽
$(window).innerWidth();
innerHeight() = height+padding+border+纵向滚动条 整个屏幕高
$(window).innerHeight();
以上是在下拙见,请多多指教
还没有评论,来说两句吧...