-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only load mobile and desktop images appropriately #361
Comments
Or is browser-native lazy-loading an acceptable/recommended option here? In which case can include as part of #355. |
Yes the best solution if responsive images with srcset here. |
BTW outstanding question with Chrome Dev team here: GoogleChrome/web.dev#1850 |
For #413 I'd also like to find a solution for swapping between an iframe on desktop and an image on mobile. |
I'd like to continue with working on @rviscomi the last commit 2cc7b8b where I replaced hero img markup with picture elements and I can work in other optimizations and clean up some best practices, etc. I've got free time over the next few days. Does that work? |
@rviscomi just circling back. I know you've been crazy busy, but wanted see if you still want the optimized, sized, and webp images I created committed, and 2cc7b8b combined to use picture elements that serve optimized images based on screen size. I know this got rushed at the end, so let me know your thoughts and I'll proceed accordingly. Cheers. |
@HyperPress think this got lost in the fun of the release, so I went ahead and submitted this in #603. Would be good to have your input as I implemented it slightly differently than you had. Still considering how to do the same for the home page... |
Currently we have things like this:
And then we show and hide the appropriate image on desktop and mobile using CSS.
However this causes both images to be load, even though one will not be used.
This can be mitigated by using background-images for these images and hiding the parent element appropriately. This causes the browser to realise whether the image will be displayed or not after evaluating the CSS and not load it unless it's needed.
So I think we should change this to something like this:
(though with the
background-image
set in CSS and not inline like this which is just done for illustrative purposes).And then set the
display:none
option on thedesktop-image
andmobile-image
styles as appropriate.Alternatively a potentially better, more accessible option is to use the
picture
andsrcset
elements, but I'm less familair with them to be honest...See here for more info: http://designingforperformance.com/responsive-web-design/#images
The text was updated successfully, but these errors were encountered: