本文摘自PHP中文网,作者angryTom,侵删。

推荐教程: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
,自己也可以做啊,相信自己的审美 -^ .^-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | < div id = "carousel-example-generic" class = "carousel slide" data-ride = "carousel" >
< 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 >
< div class = "carousel-inner" role = "listbox" >
< div class = "item active" >
< img class = "img-responsive" src = "img/0e4eb42dd4acd3aff05b1fee14820af0.jpg" />
< div class = "carousel-caption" >
< h1 >轮播1的标题</ h1 >
< p >这里是轮播图1的说明</ p >
</ div >
</ div >
< div class = "item" >
< img class = "img-responsive" src = "img/2fc4c4554273a93933af18f8a4239275.jpg" />
< div class = "carousel-caption" >
< h1 >轮播2的标题</ h1 >
< p >这里是轮播图2的说明</ p >
</ div >
</ div >
< div class = "item" >
< img class = "img-responsive" src = "img/28058504efd74a112e721e048e38aeb9.jpg" />
< div class = "carousel-caption" >
< h1 >轮播3的标题</ h1 >
< p >这里是轮播图3的说明</ p >
</ div >
</ div >
</ div >
< 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轮播图的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
bootstrap layout it怎么使用
bootstrap如何去掉边框
bootstrap对于后端工程师重要么
bootstrap3和4有什么区别
bootstrap请求javascript失败是怎么回事
bootstrap怎么实现自适应高度
bootstrap组件怎么使用
浅谈bootstraptable+jstree插件对树列表条件和查询条件的处理
bootstrap动态进度条怎么搞
bootstrap4如何设置模态框
更多相关阅读请进入《bootstrap》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » 怎么引用bootstrap轮播图