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
  • 66,495
  • 17
  • 137
  • 137
Suzi Larsen
  • 1,420
  • 5
  • 18
  • 32

2 Answers2

1
$(window).resize(function() {
   var width = $(this).width();
   var height = $(this).height();
});
Adil Shaikh
  • 44,509
  • 17
  • 89
  • 111
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
  • 66,495
  • 17
  • 137
  • 137
Piyush Bhardwaj
  • 633
  • 6
  • 22