S
S
Shing2018-07-02 18:36:32
css
Shing, 2018-07-02 18:36:32

Is it possible to prevent images for desktop (designed for desktop) from loading on mobile and vice versa?

Different pictures under the style of hidden-on-mobile and is-mobile.
But it turns out that the browser still loads all the pictures from the code or not?
Is it possible to make images under the style hidden-on-mobile not loaded on mobile, but is-mobile, respectively, on desktops? To speed up page loading.
Maybe somehow lazy loads to fasten? But no matter how much it also becomes heavier because of js / jquery.
Or do it on divas? div id="hidden-on-mobile" div id="is-mobile" and hide all images in css? Then it will work, div is-mobile on the desktop will not be loaded?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
You can just Eugene, 2018-07-02
@Shing

https://www.w3schools.com/tags/tag_picture.asp - help you! :)

I
iBird Rose, 2018-07-02
@iiiBird

Through css you can hardly do it beautifully.
For example, you can change the src attribute through js. https://jsfiddle.net/0ohaLy6n/8/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question