怎么引用bootstrap轮播图
推荐教程:Bootstrap教程
提示:这些功能都是需要插件支持的,既然是bootstrap当然不能少它的css和js文件的引入,另外还有JQuery.js,他们的版本都在3.0以上就可以了!!
1.直接引用bootstrap里的类carousel slide
做一个div容器;
2.ul标签 添加类carousel-indicators
做相应个数的图像选择器,就是那些小圆点!
3.再做一个div容器加类carousel-inner
包裹图片;
4.接下来创建一个个的图片项目包裹在div 类item中,在里面如果还需要对图片做其他说明就继续加div 类carousel-caption
添加文字说明;
5.最后一步是添加图片左右控制,a标签 添加标签类left carousel-control
和 类right-carousel-control
分别设置左右的控制键;
选取要跳转的id #carousel-example-generic
,data-slide=“left”/“right”
;
里面加上左右控制键显示的图片icon,这个可以引用 类glyphicon glyphicon-chevron-right
和 glyphicon glyphicon-chevron-left
,自己也可以做啊,相信自己的审美 -^ .^-
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ul 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> </ul> <!-- Wrapper for slides --> <div class="carousel-inner" role="listbox"> <div class="item active"> <img class="img-responsive" src="/Uploads/img/0e4eb42dd4acd3aff05b1fee14820af0.jpg"/> <div class="carousel-caption"> <h1>轮播1的标题</h1> <p>这里是轮播图1的说明</p> </div> </div> <div class="item"> <img class="img-responsive" src="/Uploads/img/2fc4c4554273a93933af18f8a4239275.jpg"/> <div class="carousel-caption"> <h1>轮播2的标题</h1> <p>这里是轮播图2的说明</p> </div> </div> <div class="item"> <img class="img-responsive" src="/Uploads/img/28058504efd74a112e721e048e38aeb9.jpg"/> <div class="carousel-caption"> <h1>轮播3的标题</h1> <p>这里是轮播图3的说明</p> </div> </div> </div> <!-- Controls --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">Next</span> </a> </div>
效果图:
以上就是怎么引用bootstrap轮播图的详细内容,更多请关注其它相关文章!