W
W
wizzzart2017-03-11 10:32:26
JavaScript
wizzzart, 2017-03-11 10:32:26

How to change image in slick slider on mobile device?

The kenwheeler.github.io/slick slider has a responsive option for responsive behavior. I have images in the slider in horizontal orientation. Is it possible somehow for a width, say, less than 800px, to change the image to a vertical one?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
iBird Rose, 2017-03-11
@iiiBird

Alternatively, put the image links in the data attribute. and then in js you change them to src images. and don't forget to reinit the slick slider.

Z
zenwarr, 2017-03-11
@zenwarr

There is also the picture tag, which allows you to use the source tag to specify different images for different media queries using something like this syntax:

<picture>
    <source src="med.jpg" media="(min-width: 40em)" />
    <source src="sm.jpg" />
    <img src="fallback.jpg" alt="" />
</picture>

True, his support is not ideal. caniuse.com/#feat=picture

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question