Method to get the height and width of a page
- 2020-03-30 02:06:54
- OfStack
Today, when making a pop-up dialog, we used the method of taking the width and height of the parent page.
Tried several ways, such as document. Body. ClientWidth, window. The screen. The width of the document. The body. After scrollWidth methods, found that is not what I want results, later found an efficient way, immediately share of:
Where to get the height and width of the breakpoint debugging debugger 】 【 , then input in monitoring page document. The body, to see all the properties of the body to see what the result is you need, if you are not suitable for still can input window, and then see if there are suitable under the window properties, today is my problem to solve in this way, property is the window. The innerWidth and window innerHeight.
I hope you can avoid detours when you encounter such problems.
Tried several ways, such as document. Body. ClientWidth, window. The screen. The width of the document. The body. After scrollWidth methods, found that is not what I want results, later found an efficient way, immediately share of:
Where to get the height and width of the breakpoint debugging debugger 】 【 , then input in monitoring page document. The body, to see all the properties of the body to see what the result is you need, if you are not suitable for still can input window, and then see if there are suitable under the window properties, today is my problem to solve in this way, property is the window. The innerWidth and window innerHeight.
I hope you can avoid detours when you encounter such problems.