feng007shuang
2017-04-16 23:31
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>LH7</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<style>
body{
padding-top: 70px;
}
.carousel{
height: 500px;
background-color: #000000;
}
.carousel .item{
height: 500px;
background-color: #000000;
}
.carousel img{
width:100% ;
}
</style>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="images/6.jpg" alt="...">
<div class="carousel-caption">
</div>
</div>
<div class="item">
<img src="images/8.jpg" alt="...">
<div class="carousel-caption">
</div>
</div>
...
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">上一页</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">下一页</span>
</a>
</div>
我觉得你应该是忘了引用bootstrap.js
我自己敲完代码也对了N多遍 也轮播不了图 才醒悟过来错误所在= =
div.carousel 设置 data-ride="carousel", 和js中设定$('#ad-carousel').carousel();都可使轮播自动进行
基于bootstrap的网页开发
187669 学习 · 734 问题
相似问题