PDA

View Full Version : Static menu/navigation that scrolls with you



madnhate
06-19-2012, 10:31 PM
I'm not sure if this is css or javascript. I feel as if this could just be z-index or something but just wanted to ask to make sure.

How would I make a menu/navigation that follows as you scroll not a floating menu but for example something like these:

Example 1 (http://www.karminmusic.com/us/home)
Example 2 (http://techcrunch.com/)
Example 3 (http://www.beyonceonline.com/us/home)

Notice how the menu just moves with the scrolling(as if following you). I want that but I am not sure how I would do it.

bernie1227
06-20-2012, 12:09 AM
Okey doke mandnhate, this is actually a fairly easy CSS problem. So the reason it follows you is because of the part in the CSS saying:


position: fixed;

Which basically means that the piece has a fixed position on the page no matter where you scroll. So for example if you had a top bar with an ID of top bar, it'd look like this.


#topbar {
position: fixed;
top: 0px;
}

bernie

madnhate
09-15-2012, 04:46 AM
I think it's actually javascript & css because I saw someone actually do something similar with javascript where the navigation is static and becomes fixed when you scroll from a javascript code. I wonder how you make it stop on a specific portion of