标签:target img 移动 复制 cti ISE style gif box
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- 指示器 --> <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> <!-- 轮播图片及说明文字 --> <div class="carousel-inner" role="listbox"> <div class="item active"> <a href="#" class="pc_imgBox" style="background-image: url(‘images/2-1.png‘)"></a> </div> <div class="item"> <a href="#" class="pc_imgBox" style="background-image: url(‘images/2-2.png‘)"></a> </div> <div class="item"> <a href="#" class="pc_imgBox" style="background-image: url(‘images/2-3.png‘)"></a> </div> </div> <!-- 控制按钮:左右切换 --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div>
.pc_imgBox{ display: block; height: 400px; width: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; } .carousel-indicators{ background: #ccc; }
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- 指示器 --> <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> <!-- 轮播图片及说明文字 --> <div class="carousel-inner" role="listbox"> <div class="item active"> <a href="#" class="pc_imgBox"><img src="images/1-1.png" ></a> </div> <div class="item"> <a href="#" class="m_imgBox"><img src="images/1-2.png" ></a> </div> <div class="item"> <a href="#" class="m_imgBox"><img src="images/1-3.png" ></a> </div> </div> <!-- 控制按钮:左右切换 --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div>
.m_imgBox{ display: block; width: 100%; } .carousel-indicators{ background: #ccc; }
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- 指示器 --> <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> <!-- 轮播图片及说明文字 --> <div class="carousel-inner" role="listbox"> <div class="item active"> <a href="#" class="pc_imgBox hidden-xs" style="background-image: url(‘images/2-1.png‘)"></a> <a href="#" class="m_imgBox hidden-lg hidden-md hidden-sm"><img src="images/1-1.png" ></a> </div> <div class="item"> <a href="#" class="pc_imgBox hidden-xs" style="background-image: url(‘images/2-2.png‘)"></a> <a href="#" class="m_imgBox hidden-lg hidden-md hidden-sm"><img src="images/1-2.png" ></a> </div> <div class="item"> <a href="#" class="pc_imgBox hidden-xs" style="background-image: url(‘images/2-3.png‘)"></a> <a href="#" class="m_imgBox hidden-lg hidden-md hidden-sm"><img src="images/1-3.png" ></a> </div> </div> <!-- 控制按钮:左右切换 --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div>
.pc_imgBox{ display: block; height: 400px; width: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; } .m_imgBox{ display: block; width: 100%; } .carousel-indicators{ background: #ccc; }
ps:实现轮播图时间间隔改变的两种方式
在data-ride后面加上一个属性data-interval=“millisecond”,其中,millisecond为需要设置的毫秒数,如下:
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="1000">
使用JavaScript语句实现:
官网给出的代码是:
$(‘.carousel‘).carousel({
interval: 2000
});
标签:target img 移动 复制 cti ISE style gif box
原文地址:https://www.cnblogs.com/cui-ting/p/10837833.html