Make a div stick.

Joined: 12/16/2007
User offline. Last seen 4 weeks 1 day ago.

Hey guys.
Quick question...
How in drupal could I make a div stick to the top of the site like done in this site - http://www.fervr.net?
I'm guessing jQuery kinda stuff is needed?

Thanks.
Paul

Paul Vaartjes

Joined: 12/27/2008
User offline. Last seen 37 weeks 7 hours ago.
CSS

As far as I can tell, it does not require JavaScript, but it's done purely with CSS. Using Firebug, I've figured out what CSS makes the header sticky:

#headerID {
background: transparent url(backgroundimage.png) repeat-x scroll left top;
height: 90px;
left: 0;
position: fixed;
top: 0;
width: 100%;
z-index: 100;
}

The key is in the fixed positioning, which keeps it at the top of the screen. Depending on your experience with CSS, you may want to find someone else to do this.

— John Grinde
http://johngrinde.com