Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  3] [ 1]  / answers: 1 / hits: 18832  / 9 Years ago, wed, august 12, 2015, 12:00:00

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 all slides on top of eachother. When pressing arrow to see next slide, the slides go back to normal. If I select the slider and want to check the components in my browser, it also goes back to normal.



Please see this example:
http://plnkr.co/edit/iw9f2alEnK0HFkv1eq16?p=preview



This is the slick configuration I'm using:



$(document).ready(function(){
$('.tourImageSlider').slick({
dots: true,
infinite: false,
slidesToShow: 3,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1500,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
}
},
{
breakpoint: 1000,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
}
}]
});
});


Would anyone have an idea of how to solve this?


More From » slick.js

 Answers
27

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.


[#65447] Monday, August 10, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bradleymoisesy

Total Points: 121
Total Questions: 105
Total Answers: 95

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
bradleymoisesy questions
Wed, Dec 22, 21, 00:00, 2 Years ago
Tue, Jun 1, 21, 00:00, 3 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
Thu, Jan 16, 20, 00:00, 4 Years ago
;