首页 > 其他 > 详细

自定义函数

时间:2015-03-24 22:42:47      阅读:237      评论:0      收藏:0      [点我收藏+]

//跨浏览器的方法

var leftX = (typeof screenLeft == ‘number‘) ? screenLeft : screenX;
var topY = (typeof screenTop == ‘number‘) ? screenTop : screenY;

//可视窗口的宽和高

var width = window.innerWidth; //这里要加window,因为IE 会无效
var height = window.innerHeight;
if (typeof width != ‘number‘) { //如果是IE,就使用document
if (document.compatMode == ‘CSS1Compat‘) {
width = document.documentElement.clientWidth;
height = document.documentElement.clientHeight;
} else {
width = document.body.clientWidth; //非标准模式使用body
height = document.body.clientHeight;
}
}

 

自定义函数

原文:http://www.cnblogs.com/laugh/p/4364067.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!