A Example for Bootstrap Scrollspy
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<style>
body {
position: relative;
}
#section1 {padding-top:50px;height:400px;color: #fff; background-color: #2894FF;}
#section2 {padding-top:50px;height:400px;color: #fff; background-color: #548C00;}
#section3 {padding-top:50px;height:400px;color: #fff; background-color: #4F9D9D}
#section41 {padding-top:50px;height:400px;color: #fff; background-color: #FF5151}
#section42 {padding-top:50px;height:400px;color: #fff; background-color: #8E8E8E}
</style>
</head>
<body data-spy="scroll" data-target=".navbar" data-offset="50">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Bootstrap</a>
</div>
<div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="#section1">Product</a></li>
<li><a href="#section2">Price</a></li>
<li><a href="#section3">Contact Us</a></li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">About<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#section41">Location</a></li>
<li><a href="#section42">Email</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
<div id="section1" class="container-fluid">
<h1>Product</h1>
<p>our product list. All Kind of books, DVDs, Mugs</p>
<p>our product list. All Kind of books, DVDs, Mugs</p>
</div>
<div id="section2" class="container-fluid">
<h1>Price</h1>
<p>contact wit our sales for qotation</p>
<p>contact wit our sales for qotation</p>
</div>
<div id="section3" class="container-fluid">
<h1>Contact Us</h1>
<p>Please call +886 7 7777777, we will answer your question.</p>
<p>Please call +886 7 7777777, we will answer your question.</p>
</div>
<div id="section41" class="container-fluid">
<h1>Location</h1>
<p>Taipei 101</p>
<p>Taipei 101</p>
</div>
<div id="section42" class="container-fluid">
<h1>Email</h1>
<p>please mail ttt@ttt.ttt.ttt</p>
<p>please mail ttt@ttt.ttt.ttt</p>
</div>
</body>
</html>
No comments:
Post a Comment