Bootstrap旋转木马不工作
Bootstrap Carousel Not working
我正在尝试实现Twitter引导转盘,但到目前为止我还没有成功。我有以下页面:
<!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>
除了旋转木马之外,所有的东西似乎都呈现正确。从阅读引导页面,似乎我需要粘贴一个
$('.myCarousel').carousel();
在某个地方,但我不知道在哪里,如何或为什么。除此之外,在Firefox错误控制台中,我得到了两个错误
$ is undefined
在bootstrap-carousel.js[第125行]和中
$ is not a function
在引导程序中-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>
您可以将它放在<head>
中的其他两个脚本之后
或者其他脚本现在在哪里。
也有同样的问题。
- 对我来说,我不得不使用jQuery 1.7.1,因为1.6.4不起作用
- 我必须包括引导程序转换
最近遇到了同样的问题,似乎在当前版本的Bootstrap中,您还必须包含一个名为slide的类。
<div id="myCarousel" class="carousel slide span12">
您定义的id不是一个类,所以您应该用jquery的这段代码启动carousel,所以替换
$('#myCarousel').carousel();
而不是
$('.myCarousel').carousel();
我使用的是Django's JQuery
(我不知道版本),但它不起作用。但是,它适用于Jquery 1.7.1
。
如果你正在努力让Bootstrap旋转木马幻灯片发挥作用——这是一个带有可定位控件的模板,底部有一个跟踪幻灯片的进度导航栏。
[http://codepen.io/TheNickelDime/][1]
<div class="Slideshow_carousel-wrapper container-fluid">
<span class="Slideshow-ctl-L" onclick="carousel_left()"></span>
<div class="carousel slide" data-ride="carousel" ... </div>
<span class="Slideshow-ctl-R" onclick="carousel_right()"></span>
</div>
<div class="container-fluid Slideshow_progress-bar">
<ul id="slideshow_progress" class="Slideshow_progress"></ul>
</div>
相关文章:
- 旋转木马;启用内容安全策略时无法工作
- 猫头鹰旋转木马2罐头't使渐变动画工作
- 我的自定义javascript旋转木马无法正常工作
- 滑动旋转木马无法使用默认样式正常工作
- 猫头鹰旋转木马2动画不工作
- 猫头鹰旋转木马2不工作Magento
- 如何让旋转木马为drupal网站工作
- 猫头鹰旋转木马-无法在线工作
- Javascript/php旋转木马无法正常工作
- TwitterBootstrap 3旋转木马不工作
- 可以'我不能让旋转木马工作
- Bootstrap旋转木马不工作
- 滑动旋转木马不工作
- 引导程序旋转木马控件不工作
- Boostrap.js旋转木马不工作
- 引导旋转木马不工作!都检查过了,还是不行
- 光滑的旋转木马-褪色效果不工作
- 圆滑的旋转木马隐藏最后一张幻灯片期间调整大小,圆滑的goto不工作如预期
- 我的引导旋转木马滑块不工作
- 猫头鹰旋转木马2不工作与循环和1项(Bug修复现在)