Resize your body using JavaScript

How to resize (width and height) a body element after loading content?

Limitations:

  • Only targeting WebKit browsers
  • Cannot use frameworks like jQuery
  • Unable to make changes to the original HTML file; only execute javascript after loading the content.
+3
source share
2 answers
window.addEventListener("load", function() {
  document.body.style.width = '600px';
}, false);
+4
source

You can use the onloadJS event in the tag <body>. For example: <body onload="ResizeBody();">. And the function might look like this:

function ResizeBody() {
    document.body.style.width=your_width;
    document.body.style.height=your_height;
}

Now it works, sorry for the previous error (not stylein the tree).

+2
source

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


All Articles