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.

dsgriffin
  • 64,660
  • 17
  • 133
  • 135
Suzi Larsen
  • 1,370
  • 5
  • 17
  • 30

2 Answers2

2
$(window).resize(function() {
   var width = $(this).width();
   var height = $(this).height();
});
Mohammad Adil
  • 44,013
  • 17
  • 87
  • 109
0

Use $(window).width() and $(window).height().

Check the below link, hopefully it will help you understand the logic:

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

dsgriffin
  • 64,660
  • 17
  • 133
  • 135
Piyush Bhardwaj
  • 623
  • 6
  • 21