Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reformat object onScroll

Status
Not open for further replies.

mirirom

Programmer
Jul 21, 2001
110
US
hi,

i'm trying to figure out how to reposition an object on a page when a user scrolls the document window. i've created a function that does this when the document loads as well as on resize, however, scrolling has no effect.

the object in question is a footer that should always appear at the bottom of the page no matter what.

the basic logic i'm using is:
~ determine the height of client window.
~ determine height of footer
~ reassign footer top property to clientHgt - footerHgt

again, this works perfectly onLoad and onResize. but when scrolling occurs, the footer simply moves along with the rest of the document.

i realize that my function pretty much duplicates the actions of assigning a static bottom value to the object, in fact it mimics it too well; assigning the bottom also has zero effect when scrolling occurs. i was hoping this function would correct this.

anyone run across this problem before? any suggestions/advice greatly appreciate. thanks!



..:: mirirom ::..
 
figured it out. didn't realize that there were properties for the window's (NS) or document.body (IE) scrolling offsets.

if anyone is curious, this did the trick.

someObject.top = document.body.height - someObject.height + document.body.scrollTop



..:: mirirom ::..
 
You might be interested in faq216-4076. There's sample code that has what you're describing.

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life--};
 
thanks! that does shed some additional light

..:: mirirom ::..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top