“动画”在导航栏与Bootstrap 3 [英] "Animation" in a navigation bar with Bootstrap 3

查看:141
本文介绍了“动画”在导航栏与Bootstrap 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的代码,我想重新创建此效果:( http://hideo-html5-css3-bootstrap-website-template.little-neko.com/files/index.html )[向下滚动导航栏变为一半]

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?

代码: http://pastebin.com/r0pS4AYD

Ps:我的代码没有什么特别的,我只想要一个点/方向

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

推荐答案

当用户滚动到特定位置时,
或在您开始滚动时可以通过jQuery添加一个类。

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

在这里查看更多信息:

滚动时使菜单栏固定在顶部

(代码取自链接中的帖子)

(Code is taken from the post in the link)

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

这是最好的,当你创建 fiddle 与你的代码,所以其他人可以很容易地修改你的代码,看看里面有什么..

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..

这篇关于“动画”在导航栏与Bootstrap 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆