airfranceklm / ng-lazy-image

Angular directive for loading responsive image when container (which is preventing reflow) is in viewport.
http://afklm.github.io/ng-lazy-image/
MIT License
351 stars 64 forks source link

Image candidate filtering does not allow to specify container dimensions #47

Closed horst80 closed 8 years ago

horst80 commented 8 years ago

When passing multiple image candidates as a srcset, the document dimensions are being used to find the best matching image. It would be great to be able to pass in the container that serves as a wrapper for the image.

The function getBestImage already supports handling a view element, but there is currently no directive attribute that allows to pass in the view.

SquadraCorse commented 8 years ago

I know the service has support, we actually had this option in the past. But you then introduce the issue you want to know when the container is resized (for example rotation screen). That introduced too much complexity and also people didn't understand it anymore in our own team.

So basically what we said was that a container is always getting some room on your screen and you define your own breakpoints per container, so if on 768 your container is halve you can serve halve the image for that specific @mq. We also have different image dimensions per breakpoint and that logic is based on how our grid flows which is always based on window.