adi*_*dit 5 twitter-bootstrap twitter-bootstrap-3
我想这样,当我按下旋转木马上的下一个按钮时,如果它已到达滑动的末端,则不要环绕并返回到第一张幻灯片.在bootstrap 3中有一个简单的方法吗?
equ*_*sde 15
将wrap选项设置为false会使轮播停止自动循环.
$('#myCarousel').carousel({
interval: 1000,
wrap: false
});
Run Code Online (Sandbox Code Playgroud)
此外,如果您想在旋转木马显示第一张/最后一张幻灯片时隐藏左右控件,您可以这样做:
$('#myCarousel').on('slid.bs.carousel', '', function() {
var $this = $(this);
$this.children('.carousel-control').show();
if($('.carousel-inner .item:first').hasClass('active')) {
$this.children('.left.carousel-control').hide();
} else if($('.carousel-inner .item:last').hasClass('active')) {
$this.children('.right.carousel-control').hide();
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13429 次 |
| 最近记录: |