0

I am using the below code in one of my pages to help me work on a site to make it responsive:

document.write(screen.width+'x'+screen.height);

The only problem is I don't wan't it showing my screen resolution size, I want it to show the browser size.

I.E, so it changes when I shrink the browser.

4

2 回答 2

2
$(window).resize(function() {
   var width = $(this).width();
   var height = $(this).height();
});
于 2013-04-22T09:57:03.737 回答
0

使用$(window).width()$(window).height()

检查以下链接,希望它可以帮助您理解逻辑:

http://api.jquery.com/category/dimensions/

于 2013-04-22T10:01:39.487 回答