本文共 530 字,大约阅读时间需要 1 分钟。
有三种方法能够确定浏览器视口的尺寸(浏览器的视口,不包括工具栏和滚动条)。
对于Internet Explorer、Chrome、Firefox、Opera 以及 Safari:
对于 Internet Explorer 8、7、6、5:
或者
实用的 JavaScript 方案(涵盖所有浏览器):
var w=window.innerWidth|| document.documentElement.clientWidth|| document.body.clientWidth;var h=window.innerHeight|| document.documentElement.clientHeight|| document.body.clientHeight;
转载地址:http://azjob.baihongyu.com/