9-20网页尺寸scrollHeight
2016-06-30 17:58
323 查看
scrollHeight和scrollWidth,获取网页内容高度和宽度。
一、针对IE、Opera:
scrollHeight 是网页内容实际高度,可以小于 clientHeight。
二、针对NS、FF:
scrollHeight 是网页内容高度,不过最小值是 clientHeight。也就是说网页内容实际高度小于 clientHeight 时,scrollHeight 返回 clientHeight 。
三、浏览器兼容性
注意:区分大小写
scrollHeight和scrollWidth还可获取Dom元素中内容实际占用的高度和宽度。
一、针对IE、Opera:
scrollHeight 是网页内容实际高度,可以小于 clientHeight。
二、针对NS、FF:
scrollHeight 是网页内容高度,不过最小值是 clientHeight。也就是说网页内容实际高度小于 clientHeight 时,scrollHeight 返回 clientHeight 。
三、浏览器兼容性
var w=document.documentElement.scrollWidth || document.body.scrollWidth; var h=document.documentElement.scrollHeight || document.body.scrollHeight;
注意:区分大小写
scrollHeight和scrollWidth还可获取Dom元素中内容实际占用的高度和宽度。
相关文章推荐
- Solr --- Group查询
- nginx开启ssl
- android 使用Canvas画箭头
- JavaScript History 对象:浏览器访问历史,history.back()、history.forward()与history.go()方法
- 9-18浏览器窗口可视区域大小
- linux 安装jdk
- 随笔
- RxBus使用
- R语言table函数
- Mac OS X中配置Apache
- Andorid6.0音量调整(设置)流程
- 9-17创建文本节点createTextNode
- 对list进行排序
- CSS文本属性
- XMG 父子控制器 自定义控制器的切换 Second
- mongodb 语句和SQL语句对应(SQL to Aggregation Mapping Chart)
- moudule.js:338 throw err; Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
- 加减乘除的c++实现
- DSM -- 远程连接,并且建立数据库连接的流程
- Swift语言精要 - 浅谈代理模式(Delegate)