imsky / holder

:city_sunrise: Client-side image placeholders.
http://holderjs.com
MIT License
5.84k stars 593 forks source link

Using holder with <picture> element doesn't work ? #195

Open thechile opened 8 years ago

thechile commented 8 years ago

Hi, not sure if it me doing something wrong or trying to do something that's not possible.

Using holder with just <img .. > works great. But if i want to do something like below to select the img based on orientation, or use webp with jpeg has the fallback then holder.js doesn't seem to work. Is it possible to have holder.js working in these situations ?

<picture>
    <source media="orientation:landscape" srcset="horizontal-image.jpg" />
    <source media="orientation:portrait" srcset="vertical-image.jpg" />
    <img src="image.jpg" alt="an image" />
</picture>

many thanks

imsky commented 8 years ago

could you post a jsfiddle that shows Holder not working?

i don't think there's built-in support, but it's definitely something that should work.

samtrion commented 8 years ago

Same problem for me...

Fiddle

samtrion commented 8 years ago

If i add text on each srcset, i get the default value... strange :/

Fiddle

imsky commented 8 years ago

will look at this, maybe worth putting it into v3 along with other general improvements. this may change the general processing logic too much to be a cheap addition.