Closed Thread Icon

Topic awaiting preservation: how do i get the total height of a document? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8076" title="Pages that link to Topic awaiting preservation: how do i get the total height of a document? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: how do i get the total height of a document? <span class="small">(Page 1 of 1)</span>\

 
hecster2k
Nervous Wreck (II) Inmate

From: sj, ca, usa
Insane since: Feb 2002

posted posted 02-12-2002 19:24

ok, here's my dilemma:

I created a floating toolbar that aligns to the bottom of my page. when i resize the page, it re-aligns by recapturing the clientHeight and setting the div's top property. so that part works. second part is what i'm having trouble with. i need to be able to calculate the overall height of the document (not the window) so that i can realign the toolbar accordingly. if i have a window open that is 100x100, for example, and align a 5px toolbar to the bottom, it would set the top at 95px. but if it scrolls, the toolbar is scrolled too. i need to align it to the bottom again, but can't capture the right values.

Bugimus
Maniac (V) Mad Scientist

From: New California
Insane since: Mar 2000

posted posted 02-12-2002 20:14

So I'm assuming you want to keep the toolbar at the bottom of your page regardless of how far down the user scrolls. This means that the toolbar will always be visible. You need to add the scroll distance to your vertical positioning of the toolbar.

For IE: y+document.body.scrollTop
For Netscape: y+window.pageYOffset

hecster2k
Nervous Wreck (II) Inmate

From: sj, ca, usa
Insane since: Feb 2002

posted posted 02-13-2002 23:51

thanks, that works!

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 02-14-2002 01:46

Supposedly...

position:fixed;
top:95px;

should also work, and won't need to be updated when the document is scrolled. If it works in new browsers, though, it won't work on old ones.

Bugimus
Maniac (V) Mad Scientist

From: New California
Insane since: Mar 2000

posted posted 09-15-2002 03:53

Addendum:

I am getting some of my pages XHTML1.0 compatible and I found an interesting behavior in IE when using scrollTop.

For this doctype,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

document.body.scrollTop no longer works but document.documentElement.scrollTop does.

I found this solution here: http://www.xs4all.nl/~ppk/js/index.html?fixedmenu.html

. . : slicePuzzle

« BackwardsOnwards »

Show Forum Drop Down Menu