V
V
Vladislav2019-12-12 11:48:50
JavaScript
Vladislav, 2019-12-12 11:48:50

Why does Slick Slider calculate slide height incorrectly?

Good afternoon.
When first loaded on a phone (and only on a phone), Slick Slider calculates the height of the slides incorrectly:

vAWJVaqCqqPLx2.jpg

D2Px65kTkkPP82.jpg

When scrolling through several slides, everything becomes as it should. When you reload the slider is also normally loaded immediately. This is a dual slider, i.e. the bottom controls the top. All pictures are the same size. The bottom slider always works fine, although the pictures in it are the same. The empty area below the picture refers to the slide, because for it you can swipe the slider.

What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2019-12-19
@BuggyBuggy

Decided:

rThisSlider.slick({
//параметры
}).on('setPosition', function (event, slick) {
  slick.$slides.css('height', slick.$slideTrack.find("img").height() + 'px');
});

Those. I equate the height of the slide to the height of the picture, and not to the height of the slider track.
But why this happens is unclear. Perhaps this is due to the image optimization module that is installed on the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question