简体   繁体   中英

How to make a navigation bar like this in Bootstrap?

http://riotdesign.eu/en/

first it seems to be a default then it changes to fixed-top and there's an animation effect in between, seems to be done in CSS

my logic is using javascript to detect the window scroll bar's offset and toggle the navbar class attribute. Can it be done in this way?

I took a look at the original page's code, didn't get nothing cuz it's too messy. And the page is pretty laggy in my browser. I figure their solution may not be wise. So I came here. :)

Correct me if I'm wrong.

You can use Bootstrap's affix component to apply the CSS transition animation when the navbar affixes to the top...

Demo: http://bootply.com/133223

Yes it can be done that way. And you can add the animation by applying CSS3 transitions on the opacity attribute of the background element.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM