Bootstrap problem with Slick Boot boot and modal

Asked

Viewed 407 times

2

Hello, I’m doing a project for a client where I’m using a modal of bootstrap and inside this modal has a Carrousel using Slick Carrousel, however I’m not sure why but it’s not starting when opening the modal, have click on something to start it, someone could guide me on this?

Q.S.: Since they are pre-made things I can’t put the code here because I’m not sure at what point you’re in trouble, but I’m a little desperate because I need to deliver this project and I can’t fix this bug.

site Slick-Carrousel:http://kenwheeler.github.io/slick/

1 answer

2

I’ll try to help you even if I don’t see your code.

If you are using the bootstrap modal or jquery dialog, you have a problem instantiating Slick, because when it is instantiated before the modal opens, 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 instantiating 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();
});

Follow an example working. http://jsfiddle.net/vanduzled/nv446jgm/2/

Try this, if it doesn’t work, send the code and we’ll analyze together.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.