Re:Chrome 34: Responsive Images and Unprefixed Web Audio
by scotth on Thursday February 27, 2014 @03:49PM
(#7314951)
I believe the element that you're looking for is <picture>, which will be shipping with a future version of Chrome.
Re:Chrome 34: Responsive Images and Unprefixed Web Audio
by PStamatiou on Thursday February 27, 2014 @03:49PM
(#7314959)
Ah right, thanks. I had been thinking that picture and srcset were competing.
Re:Chrome 34: Responsive Images and Unprefixed Web Audio
by igrigorik on Friday February 28, 2014 @02:02AM
(#7317548)
They're complementary. <picture> uses subset of original srcset spec to meet the "resolution switching" use case - e.g. see Example 1 [1]. If you want to select an asset based on viewport width, then you'd either use "sizes" attribute on picture, or a combination of srcset + sources + sizes.
Re:Chrome 34: Responsive Images and Unprefixed Web Audio
by TabAtkins on Friday February 28, 2014 @02:47AM
(#7317625)
The srcset attribute by itself can't do what you ask; it only lets you specify multiple resolutions of an image, all (intended to be) the same size.
But wait for implementation to finish, and you'll be able to use the sizes='' attribute on the <img>, or the full <picture> deal, and that'll give you more control, letting you load a smaller image if the image would take up less space.
Re:Chrome 34: Responsive Images and Unprefixed Web Audio
by kclay on Thursday February 27, 2014 @03:56PM
(#7314998)
Maybe this http://foundation.zurb.com/docs/components/interchange.html when <picture> isn't supported?
Re:Chrome 34: Responsive Images and Unprefixed Web Audio
by TazeTSchnitzel on Thursday February 27, 2014 @05:27PM
(#7315683)
I'd also be interested to know if it would use the 2x version if I zoom in the page 200% on a non-HiDPI machine.
currently very hackily checking browser width (and keeping in mind of image is used in a grid or just a full-width image on its own) to rewrite all data-src when the page loads and before lazy loading has kicked in (to prevent double image downloading) on my photoblog:
http://paulstamatiou.com/photos/carmel-monterey/