Initializing slider removes slides from DOM
See original GitHub issueWhen initializing Slick Slider v1.8.0 or v1.8.1, the Slides are removed from DOM and an empty slider is generated. When using v1.7.1, the Slides are appearing as they should.
Slider HTML (pre-init):
<div class="promoslider">
<div class="prod">
<a href="#">
<div class="imgContainer">
<img class="thumb" src="#">
</div>
<h5>Lorem Ipsum</h5>
<div class="priceContainer">
Dolor sic Amet
</div>
</a>
</div>
<!-- Repeat div class="prod" to duplicate the slides -->
</div>
Slider settings and Init Call
<script>
var sliderSettings= {
speed : 300,
slidesToShow : 1,
slidesToScroll : 1,
mobileFirst : true,
arrows : false, // For now
autoplay : true,
autoplaySpeed : 2000,
swipeToSlide: true,
responsive : [{
breakpoint : 992,
settings: 'unslick'
}, {
breakpoint : 767,
settings : {
slidesToShow : 2
}
}, {
breakpoint : 767,
settings : {
slidesToShow : 2
}
}, {
breakpoint : 468,
settings: {
slidesToShow : 1
}
}]
};
$('.promoslider').slick(sliderSettings);
</script>
Post-init Slider HTML
<div class="promoslider slick-initialized slick-slider">
<div class="slick-list draggable">
<div class="slick-track" style="opacity: 1; width: 0px; transform: translate3d(0px, 0px, 0px);">
</div>
</div>
</div>
Does anyone have an idea why Slick removes the slides from the DOM in the latest update?
Used libraries:
- Slick-carousel 1.8.1
- jQuery 3.3.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:12
Top Results From Across the Web
Slick Slider - How to Remove Specific Slides On Click
I am trying to make it work so you can remove a specific slide based on which one is clicked. <div class="slider add-remove...
Read more >Initialization - Reveal.js
The most common reveal.js use case is to have a single presentation which ... This will undo all changes that the framework has...
Read more >Slider Not Working !!! Trick to Handle ANY Slider - YouTube
Inner divs will be converted into slides. ... In our JS file, we are initializing slick slider or flex slider for the area...
Read more >Swiper API
Slides --> <div class="swiper-slide">Slide 1</div> <div ... new Swiper(swiperContainer, parameters)- initialize swiper with options.
Read more >Top 5 swiper Code Examples - Snyk
on('slideChange', function () { $('mark').removeClass('is-current-slide'); $('[data-slide="' + this.activeIndex + ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This may be related to commit be0d17cc858fb30e6a4d6b28cc29860c7170040d, which seems to have changed the default behaviour of row wrappers.
The old default was to have one row without additional wrappers. The new one is to add wrappers even when only one row is needed. That change made some other code in my project break, which relied on the given element structure.
Setting the slick option
rows
to0
worked as a fix for that issue. (as seen in a comment to the mentioned commit)Using
"slick-carousel": "~1.6"
and David’s solution fixed it for me. Thanks.