我无法在IE 9中使用scrollspy。我将代码缩减到最基本但问题仍然存在。
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="lib/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="lib/bootstrap/js/bootstrap.js"></script>
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.css" />
<style type="text/css">
#sidenav {
position: fixed;
background-color: #fff;
}
li {
width: 100px;
height: 30px;
background-color: orange;
}
li.active {
background-color: yellow;
}
a.active {
color: red;
}
.box {
width: 500px;
height: 500px;
background-color: red;
margin-top: 10px;
}
body {
height: 100%;
}
</style>
</head>
<body data-spy="scroll" target="sidenav">
<div id="sidenav">
<ul class="nav">
<li><a href="#box-1">Test</a>
</li>
<li><a href="#box-2">Test</a>
</li>
<li><a href="#box-3">Test</a>
</li>
<li><a href="#box-4">Test</a>
</li>
</ul>
</div>
<div class="box" id="box-1"></div>
<div class="box" id="box-2"></div>
<div class="box" id="box-3"></div>
<div class="box" id="box-4"></div>
<div class="box" id="box-5"></div>
<div class="box" id="box-6"></div>
<div class="box" id="box-7"></div>
<div class="box" id="box-8"></div>
</body>
<script type="text/javascript">
$('body').scrollspy({
target: '#sidenav'
});
</script>
</html>
我做错了什么?