Picture tag with source to change the Image on different views.
Unanswered
English Toy Terrier posted this in #help-forum
English Toy TerrierOP
Hello guys, I have this problem where I want to show different picture on desktop and mobile view. I did this with Vanilla js <picture>
<source srcSet="/my-dogMobile.webp" media="(max-width: 640px)" />
<img src="/my-dogDesktop.webp" alt="A beautiful labrador" loading="lazy" />
</picture>
I'm just curious if anyone know a more next js like solution for this problem because it does not seems to work with the Image component the same way.
<source srcSet="/my-dogMobile.webp" media="(max-width: 640px)" />
<img src="/my-dogDesktop.webp" alt="A beautiful labrador" loading="lazy" />
</picture>
I'm just curious if anyone know a more next js like solution for this problem because it does not seems to work with the Image component the same way.
2 Replies
@English Toy Terrier did you ever find a solution to this? I'm trying to do the same thing