Problem with slick carrousel and modal bootstrap

2
Hello, I'm doing a project for a client where I'm using a modal bootstrap and within this modal has a carrousel using the slick carrousel, though I'm not sure why but it is not starting when opening the modal, it has to click something for him to start, could anyone guide me in this regard?

PS: As things are pre-made I can not put the code here because I'm not sure at what point it is in trouble, but I'm a little desperate because I need to deliver this project and I can not fix this bug. >

site slick-carrousel: link

    
asked by anonymous 16.12.2015 / 13:37

1 answer

2

I'll try to help you even without seeing your code.

If you are using the modal bootstrap or jquery dialog, you have a problem instantiating the slick, because when it is instantiated before the modal open, the references are different and when you open the modal, everything is apparently wrong, so let's do a trick. After you call the method to open the modal, try to instantiate the slick or resize it.

Example

$('.modal').on('shown.bs.modal', function (e) {
    $('.my-slider').slick("setPosition", 0);
});

or

$('.modal').on('shown.bs.modal', function (e) {
      $('.my-slider').resize();
});

Here's an example that works. link

Try this, if it does not work, submit the code and we'll review it together.

    
16.12.2015 / 14:01