Slick carousel has 0px width when loaded in collapsed tab

后端 未结 1 777
小蘑菇
小蘑菇 2021-01-02 19:36

When loading slick slider in collapsed content (angular-bootstrap collapse plugin in this case) the .slick-track div gets 0px width, resulting in the slider trying to fit al

1条回答
  •  清酒与你
    2021-01-02 20:07

    Finally I got the answer by slick creator Ken Wheeler himself. When collapsable content is triggered open, simply call the following line:

    $('.slider-class').slick('setPosition');
    

    ...and replace "slider-class" with the class name of your slider. Personally I created an angular function with this line, and triggered it with ng-open.

    0 讨论(0)
提交回复
热议问题