[Introduction] When I was making a pop-up dialog today, I came across the method of getting the width and height of the parent page. After trying several methods, such as document body clientWidth, window screen width, document body scrollWidth and other methods, I found that none of them were the results I wanted. Finally
When I was making a pop-up dialog today, I encountered the problem of fetching The width and height methods of the parent page.
After trying several methods, such as document.body.clientWidth, window.screen.width, document.body.scrollWidth, etc.
, I found that none of them are what I want. As a result, I later discovered an efficient method and immediately shared it with everyone:
Add breakpoint debugging [debugger] where the height and width need to be obtained, and then enter document.body in the monitoring page , check all
body attributes to see which result you need. If it is not suitable, you can also enter window, and then see if there are suitable attributes under window. My question today is
The solution is solved in this way, the properties are window.innerWidth and window.innerHeight.
The above is the detailed content of Get the height and width of the page through js. For more information, please follow other related articles on the PHP Chinese website!