Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slick.js and multiple Twitter Bootstrap Modal Windows

I have multiple modal window and inside have slick.js sliders. The problem is that the slider doesn't show up as if it doesn't have any height and you have to wait for awhile or click on the bullets for the image to show up.

One solution I got was to add a resize() when the modal is shown:

$('.modal').on('shown.bs.modal', function (e) {
  $('.carousel').resize();

})

But this only solves the issue for one modal window's slider. If you click on the other modal, the slider will not show up again. Here's a js fiddle:

http://jsfiddle.net/vanduzled/nv446jgm/2/

like image 574
vanduzled Avatar asked Dec 20 '22 10:12

vanduzled


2 Answers

I managed to get this to work with multiple modal windows with the following:

$('.modal').on('shown.bs.modal', function (e) {
    $('.product-slider').slick("setPosition", 0);
});
like image 151
codecrunch Avatar answered Dec 21 '22 23:12

codecrunch


above solution also worked but it not smooth try this it work like charm

.modal {
    display: block;
    visibility: hidden;
    overflow-y: hidden;
}
.modal.in {
    visibility: visible;
}
like image 22
Bharat Parmar Avatar answered Dec 22 '22 00:12

Bharat Parmar