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
350 stars 64 forks source link

Retrieve offset relative to the $container instead of the first positioned parent #6

Closed TimonVS closed 9 years ago

TimonVS commented 9 years ago

Fix lazy loading images in a container to use the offset relative to the $container instead of the first positioned parent.

The unit test isn't nice.

SquadraCorse commented 9 years ago

grunt jshint :) also html expected is cross browser error prone, so we will look at the test anyway.

SquadraCorse commented 9 years ago

calulcation is wrong, inspect network traffic and you will see this. By using the same image i guess you didn't notice it. It also counts for the solution which is now also in this version.

        <div class='demo-container-content-positioned-parent'>
            <div afkl-lazy-image="//placehold.it/936x677/00a1de/ffffff" class='afkl-lazy-wrapper afkl-img-ratio-3-2 demo-container-content-positioned-child'></div>
        </div>
        <div class='demo-container-content-positioned-parent'>
            <div afkl-lazy-image="//placehold.it/936x468/fc425b/ffffff" class='afkl-lazy-wrapper afkl-img-ratio-2-1 demo-container-content-positioned-child'></div>
        </div>
        <div class='demo-container-content-positioned-parent'>
            <div afkl-lazy-image="//placehold.it/936x677/2df3d/ffffff" class='afkl-lazy-wrapper afkl-img-ratio-3-2 demo-container-content-positioned-child'></div>
        </div>
wall101482 commented 1 year ago

Fix lazy loading images in a container to use the offset relative to the $container instead of the first positioned parent.

The unit test isn't nice.

Loading images needs attention