How can I change the dimensions (width, height) of the body element after the content has been loaded?
Restrictions:
- Only targeting WebKit browsers
- Can't use frameworks like JQuery
- Can't make changes to the original HTML file; only execute JavaScript after the content has been loaded.
How can I change the dimensions (width, height) of the body element after the content has been loaded?
Restrictions:
- Only targeting WebKit browsers
- Can't use frameworks like JQuery
- Can't make changes to the original HTML file; only execute JavaScript after the content has been loaded.
- This sounds like a CSS issue... – Nick Craver Commented Oct 2, 2010 at 12:10
2 Answers
Reset to default 6window.addEventListener("load", function() {
document.body.style.width = '600px';
}, false);
You may use the onload
JS event in your <body>
tag.
For example: <body onload="ResizeBody();">
.
And the function may look like this:
function ResizeBody() {
document.body.style.width=your_width;
document.body.style.height=your_height;
}
Now it works, sorry for the previous mistake (missing style
in the tree).