做手机Web开发做浏览器兼容用到了
2012-08-03 20:37
183 查看
alert($(window).height()); //浏览器当前窗口可视区域高度 alert($(document).height()); //浏览器当前窗口文档的高度 alert($(document.body).height());//浏览器当前窗口文档body的高度 alert($(document.body).outerHeight(true));//浏览器当前窗口文档body的总高度 包括border padding margin alert($(window).width()); //浏览器当前窗口可视区域宽度 alert($(document).width());//浏览器当前窗口文档对象宽度 alert($(document.body).width());//浏览器当前窗口文档body的高度 alert($(document.body).outerWidth(true));//浏览器当前窗口文档body的总宽度 包括border padding margin // 获取页面的高度、宽度 function getPageSize() { var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else { if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer if (document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else { if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else { if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } } } // for small pages with total height less then height of the viewport if (yScroll < windowHeight) { pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if (xScroll < windowWidth) { pageWidth = xScroll; } else { pageWidth = windowWidth; } arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight); return arrayPageSize; } // 滚动条 document.body.scrollTop; $(document).scrollTop();
相关文章推荐
- 最近用到的浏览器兼容javascript总结
- 收集的CSS浏览器兼容问题大全(粘贴过来,会用到的)
- html兼容手机浏览器
- html页面音乐播放器 基于audiojs 整体改编 兼容所有浏览器和手机
- angular解决手机浏览器不兼容问题
- PC管理端及评委手机打分端的浏览器兼容问题
- 最近做了个手机开发资料站,不知道为什么会有浏览器兼容问题,累死了~~~~~~~~~~
- 一个PHP文件搞定支付宝系列之手机网站支付(兼容微信浏览器)
- 基于黑莓手机浏览器的Web开发研究
- 关于HTML5属性placeHolder在手机浏览器不兼容问题
- web开发中的各种浏览器的兼容问题
- 论flex布局和box布局的华为meta8手机自带浏览器的兼容
- 收集的CSS浏览器兼容问题大全(粘贴过来,会用到的)
- 最近用到的浏览器兼容javascript总结
- 网页在一些原生手机浏览器上面出现兼容问题
- html网页兼容手机浏览器(解决显示页面很小的问题)
- 最近用到的浏览器兼容javascript总结
- 网页能够兼容所有手机浏览器
- 浏览器&手机屏幕兼容
- web开发-浏览器兼容策略-jquery框架