我只是无法从 bootstrap 3 中获得 scrollspy 工作。我已经尝试了从无数论坛中阅读的所有内容,包括 stackoverflow 的答案,但没有成功。
因此,如果有人可以查看此代码并提供帮助,那就太好了。
这是代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../assets/ico/favicon.png">
<title>Starter Template for Bootstrap</title>
<!-- Bootstrap core CSS -->
<link href="../../dist/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="starter-template.css" rel="stylesheet">
<style type="text/css">
body {
text-align: center;
}
#one, #two, #three, #four {
height: 800px;
}
</style>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="../../assets/js/html5shiv.js"></script>
<script src="../../assets/js/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#side-nav" data-offset="0">
<nav id="side-nav">
<ul class="nav nav-list affix">
<li><a href="#one">one</a></li>
<li><a href="#two">two</a></li>
<li><a href="#three">three</a></li>
<li><a href="#four">four</a></li>
</ul>
</nav>
<section id="one">one section</section>
<section id="two">two section</section>
<section id="three">three section</section>
<section id="four">four section</section>
</body>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../../assets/js/jquery.js"></script>
<script src="../../dist/js/bootstrap.min.js"></script>
</body>
</html>
提前致谢!!干杯!
编辑:您可以检查它在以下 URL 中不起作用:http: //zumuha.site40.net/bootstrap/examples/starter-template/
干杯!