轮播引导程序不起作用 [英] Carousel bootstrap doesn't work
本文介绍了轮播引导程序不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮助我吗?我正在测试自举轮播,但无法正常工作。具体来说:上一个/下一个按钮不起作用,轮播也不会滑动到下一张幻灯片。这是我页面的代码,但我不知道自己在做什么错。
Someone can help me?I'm testing the bootstrap carousel but it doesn't work. Specifically: the previuos/next buttons don't work and the carousel doesn't slide to the next slide. this is my page's code but I don't know what I'm doing wrong.
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<!-- META -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- META -->
<!-- CSS -->
<link href="css/stile.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<!-- CSS -->
</head>
<body>
<div class="container">
<div id="myCarousel" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="image1.jpg" alt="image1.jpg">
</div>
<div class="item">
<img src="image2.jpg" alt="image2.jpg">
</div>
<div class="item">
<img src="image3.jpg" alt="image3.jpg">
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="icon-next"></span>
</a>
</div>
</div>
<!-- JS -->
<script src="//code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- JS -->
</body>
</html>
推荐答案
您是否使用以下JS调用了轮播? / p>
Have you called the Carousel with the below JS?
$('.carousel').carousel({
interval: 2000
})
尝试将链接/脚本放在顶部:
Try putting the link/script at the top:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
这些是嵌入的链接,而不是根文件中的链接。您可以使用您的,但将它们放在顶部,看看是否有帮助。
These are embeded links and not from your root file. you can use yours but place them at the top and see if that helps.
这篇关于轮播引导程序不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文