문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top