最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Slick.js and multiple Twitter Bootstrap Modal Windows - Stack Overflow

programmeradmin4浏览0评论

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:

/

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/vanduzled/nv446jgm/2/

Share Improve this question asked Oct 9, 2014 at 6:33 vanduzledvanduzled 3004 silver badges16 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

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);
});

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;
}

Hey man i think your solution is actually a very good one.

I changed it slightly, so i apply the slick carousel when the modal is shown:

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

})
发布评论

评论列表(0)

  1. 暂无评论