Atr*_*rus 5 javascript twitter-bootstrap
我正在尝试实现Twitter Bootstrap轮播,到目前为止我一直没有成功.我有以下页面:
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset="utf-8">
<title>Fluxware: Play, learn and build games</title>
<meta name="description" content="Home page for Fluxware">
<meta name="author" content="Tim Butram">
<!-- CSS Stylesheets -->
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="../bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<!--For shitty webbrowsers -->
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/sbn/trunk/html5.js></script>
<![endif]-->
<!-- Favicon -->
<link rel="favicon" href="images/favicon.ico">
</head>
<body>
<!-- Navbar -->
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Play</a></li>
<li><a href="#">Learn</a></li>
<li><a href="#">Build</a></li>
</ul>
</div>
</div>
</div>
<!-- Grid -->
<div class="container">
<div class="row">
<div class="span12">
<div class="hero-unit">
<div id="myCarousel" class="carousel">
<div class="carousel-inner">
<div class="active item"><img src="/images/1.png" /></div>
<div class="item"><img src="./images/2.png" /></div>
<div class="item"><img src="./images/3.png" /></div>
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
</div>
<div class="row">
<div class="span4">
<a class="btn btn-large">Play</a>
<p>Play games created with Fluxware.</p>
</div>
<div class="span4">
<a class="btn btn-large">Learn</a>
<p>Learn how to create games and game assets</p>
</div>
<div class="span4">
<a class="btn btn-large">Build</a>
<p>Use the Fluxware tools to create game.</p>
</div>
</div>
</div>
</div>
</div>
<script src="../bootstrap/js/jquery.js"></script>
<script src="../bootstrap/js/bootstrap-carousel.js"></script>
<script src="../bootstrap/js/bootstrap-transition.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
除旋转木马外,一切似乎都能正确呈现.从阅读Bootstrap页面看来,我需要坚持下去
$('.myCarousel').carousel();
Run Code Online (Sandbox Code Playgroud)
在某个地方,但我不知道在哪里,如何或为什么.除此之外,在Firefox错误控制台中,我得到了两个错误
$ is undefined
Run Code Online (Sandbox Code Playgroud)
在bootstrap-carousel.js [第125行]和
$ is not a function
Run Code Online (Sandbox Code Playgroud)
在bootstrap-transition.js [第22行]
显然jQuery没有正确加载.
尝试在页面中加载两个脚本<head>.
运行轮播的代码是
<script>
// Load this when the DOM is ready
$(function(){
// You used .myCarousel here.
// That's the class selector not the id selector,
// which is #myCarousel
$('#myCarousel').carousel();
});
</script>
Run Code Online (Sandbox Code Playgroud)
您可以将其放在<head>其他两个脚本之后
或其他脚本现在的位置.
| 归档时间: |
|
| 查看次数: |
60656 次 |
| 最近记录: |