jquery-tutorialsmade

Find height and width of the viewport of the Browser!

This tutorial shows you how to find the exact height and width of the Viewport of the Browser using jQuery. This code works for all the browsers, basically popular browsers such as Chrome, Firefox, Internet Explorer, Safari, Opera etc.,

Here is the code for find the Height of browser window:

Here is the code for find the Width of browser window:

Lets see an example with the above functions:

If you see the above script I have used two p tags to show the height and width of the browser.

append() is the jQuery function to append the text along with the existing text.

So, the output will be like this:

Width of your Browser Viewport is 1600

Height of your Browser Viewport is 799

 

Note: 1600 and 799 is the width and height of my browser. This will differ for yours!

Next tutorial – Dynamically find the width and height of the browser when the browser Resized.

Related Posts

Leave a Reply