jQuery can be used to get the dimensions of the current page. The dimensions include the screen, viewport and document height, and width.
- Getting the window dimensions: Window size is the size of the browser window. This is the size that changes when the browser is resized. The windows height and width can be accessed with the height() and width() method after selecting the window object.
- Getting the document dimensions: Document size is the size of the HTML document. The documents height and width can be accessed with the height() and width() method after selecting the document object.
- Getting the screen dimensions: Screen size is the total size of the user’s screen. The screen’s height and width can be accessed with the height and width property.
- Before clicking the button:
- After clicking the button:
- How to jump to top of browser page using jQuery?
- How to give a div tag 100% height of the browser window using CSS
- How to center a popup window on screen?
- Get the current URL using jQuery?
- How to refresh a page using jQuery?
- How to scroll automatically to the Bottom of the Page using jQuery?
- JQuery | Set focus on a form input text field on page load
- jQuery | size() with Examples
- How to get the input file size in jQuery ?
- What is the difference between “screen” and “only screen” in media queries?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.