I'm trying to make a fixed-top navbar that will collapse/fold as the user scrolls down, and will reappear/unfold the instant they scroll up even if they're at the bottom of the page.

我正在尝试制作一个固定顶部导航栏,当用户向下滚动时会折叠/折叠,并且即使它们位于页面底部,它们也会在它们向上滚动的瞬间重新出现/展开。

I'm not even sure where to begin with this. Here's the basic layout I'm experimenting with:

我甚至不确定从哪里开始。这是我正在尝试的基本布局:

http://jsfiddle.net/pp5dLdxw/

<!DOCTYPE html>

<html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body style="padding-top:70px;">

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="#">foo</a>
        </div>
    </div>
</nav>

<div class="container">
    <div class="jumbotron" style="height:900px;">bar</div>
</div>

</body>
</html>

1 个解决方案

#1


0

Found https://github.com/istvan-ujjmeszaros/bootstrap-autohidingnavbar

With some really simple steps to set it up:

通过一些非常简单的步骤进行设置:

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/js/bootstrap.min.js"></script>

<script src="dist/jquery.bootstrap-autohidingnavbar.min.js"></script>

$(".navbar-fixed-top").autoHidingNavbar({
  // see next for specifications
});

更多相关文章

  1. HTML CSS Javascript中 id重复时会发生的 情况
  2. PyGobject(五十六)布局容器之TreeView(上)
  3. 求助:从库mysqldump 时,mysql 有时会导致重启……
  4. Android View - 实现流式布局
  5. Android入门二(五大布局)
  6. Android TagFlowLayout完全解析 一款针对Tag的布局
  7. android自定义view实现流式布局(FlowLayout)和热门标签
  8. [置顶] 浅谈Android五大布局——LinearLayout、FrameLayo
  9. 如何创建一个四位数的密码Android布局

随机推荐

  1. Android应用安全之Android平台上的跨应用
  2. android:taskAffinity && android:allowT
  3. 【Android 开发】: Android 消息处理机制
  4. [Android]发布Sqlite数据库
  5. Android Wear带你理解跨设备的Android 技
  6. android之listview使用方法(一)
  7. Android之AndroidStudio生成jar
  8. Android-横屏应用在竖屏情况下解锁引起销
  9. Android 面试题总结之Android 基础(五)
  10. Project Volta 让 Android 续航提升了多