Forum Moderators: open
Eddie Traversa
[dhtmlnirvana.com...]
I'm not sure the web is ready for that.
>capturing the dimensions of offscreen content, you can use document.body.scrollHeight... document.height
I want to determine the total length of the onscreen ( innerHeight or document.body.clientHeight) plus the offscreen content yet to be scrolled, i.e, what's below the fold. I tried adding document.height or document.body.scrollHeight but that isn't working.
Hmmmm.... maybe the problem is because I'm using a remote js file and don't have the body id'd.
Opera needs to get more DOM support in or dramitically increase its client based before I start supporting it.
RC is this the problem, lets say you have a layer thats 2000 pixels long but on screen lets say 600 pixels of that layer is viewable. Are you wanting to capture the layers true height eg the 2000 value?
Yes. I was playing around with the alchemy script for dynamic image resizing [dhtmlnirvana.com] and thought it would be a great utility to have a spacer image that I could resize vertically on-the-fly, the length being based on the total content of the page. You could make unrelated side-by-side tables end at the same point, for example.
<body onload="alert(document.body.clientHeight);alert(document.getElementById('content').clientHeight)">
<div style="position:absolute" id="content">
content<br>
content<br>
content<br>
content<br>
content<br>
</div>
</body>
If you pad out the content so that it's longer than the fold you should see the desired results in the alert. Needless to say that this is IE (5+???) only.
When you think about it - this approach to grabbing the size of rendered elements can be incredibly useful! I've used it a lot for a recent high end IE5+ only application.... sweeet.
Josh
if (is.ns6 ¦¦ is.ns6x) {
var divHeight = document.getElementById("yourDivID").offsetHeight;
}
else if (is.dom) {
var divHeight = document.all["yourDivID"].offsetHeight;
}
else if (is.ns4) {
var divHeight = (document.layers["yourDivID"].document.height);
}
> incredibly useful!
Yep, I can mathematically position all divs on the page (NS4, NS6, IE). By determining the height and width of any div and have them as variables, I can then place other divs in what appears to be relative positioning. It's absolute positioning, so many of the NS4 problems go away (though there are still some to deal with).