I'm trying to reinitialize slick upon orientation change. My slides start centered, but when changing to landscape mode they align left. Upon refresh (at the new orientation) everything is back to normal.
I assume reInit is what I need, so I tried the following in my document ready:
// Large Product Carousel
$('.large-product-carousel').slick({
infinite: true,
speed: 250,
........ [[ truncating several other options ]] .......
slidesToShow: 1,
adaptiveHeight: true,
variableWidth: true
});
$(window).resize(function(){
$('.large-product- carousel').slick('resize');
});
$(window).on('orientationchange', function() {
$('.large-product-carousel').slick('reinit');
});
I've tried with both reinit and reInit (case), but maybe I'm barking up the wrong tree.
Slick version is: Version: 1.6.0
Might try setPosition. Providing a debugging assist is easier with a fiddle/codepen. Thanks!
I had a similar issue and solved it by including this in my document ready...
$(window).on('orientationchange', function() {
$('.my-slider').slick('resize');
});
If that alone doesn't work, try adding mobileFirst: true to your settings.
Most helpful comment
I had a similar issue and solved it by including this in my document ready...
If that alone doesn't work, try adding mobileFirst: true to your settings.