Resize popup based on width and height of content

I have an html page with different sizes. Based on the conditions, I hide some content. How can I get the width and height of the body using javascript so that I can dynamically resize the window depending on the amount of page content. Thank...

+3
source share
2 answers

I would carefully resize the browser windows because it became annoying very quickly (especially if the user opens the page directly, and not as a pop-up window). What if the user wants a little space around the content to make it easier to read? In most browsers, you can also disable some Javascript effects, such as moving and resizing windows - they can be disabled by default.

The icabod idea of ​​wrapping content in a div should work fine, at least for height. If the width still shows the full width of the current window, try adding float:leftand it will match the width of the content.

script . , , HTML/iframed , .

+5

, document.body.offsetWidth document.body.offsetHeight . , , , ..

, . , , -.

+3

Source: https://habr.com/ru/post/1736339/


All Articles