JQuery: IE window width

My computer's screen width is 1280, but why does IE say it's 1259, but other browsers say it's 1280 with widht () ;?

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

can this be installed for IE? look at here,

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

Thanks Lau

+3
source share
3 answers

window.width() does not give you the width of the screen, but the current window.

IE will always show a disabled scrollbar to the right of your document, even if it is not needed.

I guess the width that is subtracted in IE.

Try using screen.availWidthto get the full screen width.

+3
source

Use $(document).width()

+1
source

, !

,

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

chrome, IE

+1

Source: https://habr.com/ru/post/1768096/


All Articles