“Animation” in a navigation bar with Bootstrap 3

懵懂的女人 提交于 2019-12-11 06:57:56

问题


Below is my code and I'm trying to recreate this effect: (http://hideo-html5-css3-bootstrap-website-template.little-neko.com/files/index.html) [When you scroll down the navigaiton bar changes to half size and with some transparency or something like that.] Any ideas to remake it?

Code: http://pastebin.com/r0pS4AYD

Ps: My code has nothing special and I just want a point/direction to make it.


回答1:


When the user scolls to an specific position,
or in your case when he begins to scroll, you can add an class via jQuery.

Look here for more information:

Leave menu bar fixed on top when scrolled

(Code is taken from the post in the link)

$(window).bind('scroll', function() {
     if ($(window).scrollTop() > 50) {
         $('.menu').addClass('fixed');
     }
     else {
         $('.menu').removeClass('fixed');
     }
});

it is the best when you create an fiddle with your code, so other people can easy modify your code and see whats going on there..



来源:https://stackoverflow.com/questions/21558960/animation-in-a-navigation-bar-with-bootstrap-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!