请检查插件
http://ashleydw.github.io/lightbox/#image-gallery
HTML:
<div id="myCarousel" class="carousel slide" data-interval="3000" data-ride="carousel">
<!-- Carousel indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Carousel items -->
<div class="carousel-inner">
<div class="active item">
<a href="http://25.media.tumblr.com/de356cd6570d7c26e73979467f296f67/tumblr_mrn3dc10Wa1r1thfzo6_1280.jpg" data-gallery="global-gallery" data-parent="" data-toggle="lightbox">
<figure>
<img src="//25.media.tumblr.com/de356cd6570d7c26e73979467f296f67/tumblr_mrn3dc10Wa1r1thfzo6_400.jpg" class="img-responsive" alt="">
<figcaption>@gregfoster</figcaption>
</figure>
</a>
</div>
<div class="item">
<a href="http://distilleryimage10.ak.instagram.com/85c5d0e4039411e3bd9b22000aa82186_7.jpg" data-toggle="lightbox" data-gallery="global-gallery" data-parent="">
<img src="//distilleryimage10.ak.instagram.com/85c5d0e4039411e3bd9b22000aa82186_7.jpg" class="img-responsive">
</a>
</div>
<div class="item">
<a href="http://25.media.tumblr.com/de356cd6570d7c26e73979467f296f67/tumblr_mrn3dc10Wa1r1thfzo6_1280.jpg" data-gallery="global-gallery" data-parent="" data-toggle="lightbox">
<figure>
<img src="//25.media.tumblr.com/de356cd6570d7c26e73979467f296f67/tumblr_mrn3dc10Wa1r1thfzo6_400.jpg" class="img-responsive" alt="">
<figcaption>@gregfoster</figcaption>
</figure>
</a>
</div>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
JS:
$(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) {
event.preventDefault();
$(this).ekkoLightbox();
});
工作小提琴:http://jsfiddle.net/52VtD/8900/
在上面的代码中,我已经实现了带有自举模式的图像滑块,前面和下一个按钮,你可以看到。现在我的问题是当我点击图像模态弹出窗口打开图像但在背景时图像的滑动必须暂时停止,直到弹出窗口关闭..但它没有发生......所以任何人都可以点亮它。
答案 0 :(得分:1)
如果这个插件暴露任何事件,我找不到任何东西,所以它就是bootstrap模态事件。 在模态显示暂停轮播和模态隐藏重新启动它。
var carousel = $('#myCarousel');
var body = $('body');
body.on('show.bs.modal', '.ekko-lightbox', function () {
carousel.carousel('pause');
})
body.on('hide.bs.modal', '.ekko-lightbox', function () {
carousel.carousel('cycle');
})