Answer the question
In order to leave comments, you need to log in
How to upload other images on mobile devices in Slick Slider?
Good day
There is a Slick Slider on this markup
<div class="slider">
<div class="slide">
<picture>
<source srcset="img/slides/slide-new-1.webp" type="image/webp">
<source srcset="img/slides/slide-new-1.jpg" type="image/jpeg"> <img src="img/slides/slide-new-1.jpg">
</picture>
</div>
<div class="slide">
<picture>
<source srcset="img/slides/slide-new-1.webp" type="image/webp">
<source srcset="img/slides/slide-new-1.jpg" type="image/jpeg"> <img src="img/slides/slide-new-1.jpg">
</picture>
</div>
</div>
$('.slider').slick({
infinite: true,
slidesToShow: 1,
slidesToScroll: 1,
dots: true,
arrows: false,
autoplay: true,
fade: true,
autoplaySpeed: 5000
});
Answer the question
In order to leave comments, you need to log in
Piccha is just created for adaptability and maximum savings in traffic and resources.
1st option - use media queries for source: media="(max-width: 1200px)"
2nd option - srcset:
<srcset="image-small.png 320w, image-medium.png 800w, image-large.png 1200w">
const isSmallScreen = window.innerWidth < X;
const src = isSmallScreen ? smallImg : bigImg
const img = document.querySelector(myImg);
img.src = src;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question