开发者

Jquery: IE window width

开发者 https://www.devze.com 2023-01-19 00:27 出处:网络
my computer screen width is 1280 but why IE says it\'s 1259 but other b开发者_如何学Gorowsers say 1280 with widht();?

my computer screen width is 1280 but why IE says it's 1259 but other b开发者_如何学Gorowsers say 1280 with widht();?

$(document).ready(function(){
    alert($(window).width());
});

can it be fixed for IE?? have a look here,

http://ec-ener.eu/dump/index3.php

Thank, Lau


window.width() doesn't give you the screen's width, but the current window's.

IE will always show a disabled scroll bar to the right of your document, even when it's not needed.

I assume it's that width that gets subtracted in IE.

Try using screen.availWidth to get the full screen width.


Use $(document).width()


I had the same problem as you!

I found that using

var height = window.innerHeight || $(window).height();
var width = window.innerWidth || $(window).width();

will give the same value both in chrome and IE

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号