<!DOCTYPE html>
<html>
<head>
<title>Bootstrap实例</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css">
<script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script src="https://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<style>
.affix {
top: 20px;
z-index: 9999 !important;
}
</style>
</head>
<body>
<div class="container-fluid" style="background-color:#2196F3;color:#fff;height:200px;">
<h1>Bootstrap Affix实例</h1>
<h3>附加垂直导航条</h3>
<p>滚动页面查看在使用 data-spy="affix" 后左侧导航的行为</p>
<p>滚动指定数量的像素后,导航栏会附加到页面顶部。</p>
</div>
<br>
<div class="container">
<div class="row">
<nav class="col-sm-3">
<ul class="nav nav-pills nav-stacked" data-spy="affix" data-offset-top="205">
<li class="active"><a href="#section1">章节 1</a></li>
<li><a href="#section2">章节 2</a></li>
<li><a href="#section3">章节 3</a></li>
</ul>
</nav>
<div class="col-sm-9">
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
<h1>一些文本以确保页面滚动</h1>
</div>
</div>
</div>
</body>
</html>