var maskWidth = $(window).width();
alert(maskWidth);
我从chrome和firefox获得1263(实际上是1280,但是滚动它写的值较少)。 IE打印1259。
如何使用JQuery修复此问题?
答案 0 :(得分:4)
这不是jQuery的问题,它会返回您网站可显示部分的值。
您需要查看.innerWidth()
here,这会返回更接近您需要的结果。
答案 1 :(得分:1)
$.clientCoords = function(){
if(jQuery.browser.msie){
return {
w:document.documentElement.offsetWidth,
h:document.documentElement.offsetHeight
}
}
else
return {w:window.innerWidth, h:window.innerHeight}
}
此函数返回浏览器或当前窗口的高度和重量