Answer the question
In order to leave comments, you need to log in
How to fix Slick Slider in modal window?
Basically, I have a button that brings up a modal window. The modal has a slider. With a large screen (more than 560px), under the slider there should be a slider with the option to switch pictures. And with a small screen, there is no slider under. In js I have set:
if ($(window).width() <= '560') {
arrowsTop = true // Показывать ли стрелки напротив большой картинки
} else {
arrowsTop = false
} // При нажатии на кнопку
$(window).resize(function() {
if ($(window).width() <= '560') {
arrowsTop = true
} else {
arrowsTop = false
}
}) // При изменении ширины экрана
$('.popup__slider').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: arrowsTop,
fade: true,
asNavFor: '.popup__slider_nav'
});
$('.popup__slider_nav').slick({
slidesToShow: 3,
slidesToScroll: 1,
asNavFor: '.popup__slider',
centerMode: true,
arrows: true,
focusOnSelect: true
});
})
Answer the question
In order to leave comments, you need to log in
You need to "reload" the slider when you change the resolution
$(window).on('resize', function() {
$('.popup__slider').slick('resize');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question