luis-almeida / unveil

A very lightweight jQuery plugin to lazy load images
4.16k stars 676 forks source link

best practice for unveil + retina + responsive? #71

Closed alxndr-w closed 4 years ago

alxndr-w commented 10 years ago

Hi!

What would be a simple solution to serve unveil two different data-src-retina-paths? One for a mobile screen size and one for the desktop?

I think it's a common use case but i don't have any idea how to solve it. And I didn't found any well documented solution, so i would be happy if someone will add a solution here :)

revelt commented 9 years ago

Hi

I came across this post looking for the same. What we're asking for is by magnitude more complex - it's not simple 1) retina detection + 2) element position on screen query. It's now extra 3) image container's size. And 3. is changing from one image to another...

Although should be doable. Just more attributes and more JS weight..

alxndr-w commented 9 years ago

It's not about adding more complexity, modern browsers already understand the picture element and media queries. See also: element (with img-tag as a fallback). The browser will decide, which image would fit best but atm, there is no possibility to add those additional tags/attributes.

I'm just not a programmer, so I can't go for a PR.

alxndr-w commented 9 years ago

(Can't edit my post on mobile, I wrote: “See also: picture-Element)