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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Header trailer in Javascript

Status
Not open for further replies.

WebmasterA

Programmer
Mar 26, 2004
25
US
Hello,

I am looking for a code example that does header trailer in Javascript. Meaning when my page is very long and I need to scroll down I need a particular banner/header to be visible all the time. For example if the table data is too long I need to be able to see table heading no matter how far down I have scrolled.

Thank you.
 
Code:
window.onscroll = function(){document.getElementById('trailer').style.top = document.body.scrollTop + "px";};

<div id="trailer" style="position: relative; z-index: 2;"><h1>WELCOME AND SHUT UP!</h1></div>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top