Reputation: 615
please check the plugin
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();
});
Working fiddle : http://jsfiddle.net/52VtD/8900/
In the above code i had implemented image slider with bootstrap modal with previous and next buttons as you can see.so now what my problem is when i click image the modal popup opens with a image but at background the sliding of images must be stopped temporarily untill the popup is closed..but it is not happening...so anyone throw some light on it.
Upvotes: 1
Views: 126
Reputation: 20393
I can not find anything if this plugin exposes any event, so bootstrap modal events it is. On modal show pause carousel and on modal hide restart it.
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');
})
http://jsfiddle.net/52VtD/9560/
Upvotes: 1