document.body.offsetHeight的问题

document.body.offsetHeight在火狐浏览器下所得的值为0,此时可以使用document.body.offsetHeight来代替,可在代码中加入如下判断:

var CurrentBodyHeight=document.body.offsetHeight > 0 ? document.body.offsetHeight :document.body.clientHeight;

//注:以上代码未经完整测试,某些浏览器支持的顺序可能不同。

相关文章: 

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

还没有评论。

发表评论

(必填)

(必填)