angular-masonry icon indicating copy to clipboard operation
angular-masonry copied to clipboard

imagesLoaded not working

Open paramsinghvc opened this issue 9 years ago • 4 comments

I'm using this directive to generate the list of products with images but the images are loaded very badly slowly and overlapping on each other in the beginning. Apparently, the imagesLoaded plugin isn't working at all. Here's my code :

<ul class="productsList" masonry infinite-scroll="loadMore()" infinite-scroll-disabled="endReached" infinite-scroll-immediate-check="false">
     <li class="col-sm-4 col-lg-3 masonry-brick" masonry-brick ng-repeat="product in products">
             // markup for an item
     </li>
</ul>

screen shot 2015-07-15 at 7 53 37 am

Please Help! Urgent!!

paramsinghvc avatar Jul 15 '15 02:07 paramsinghvc

I am experiencing this issue without using infinite scroll. Steps to consistently reproduce:

  • in chrome, disable browser cache and set network throttling to ~Regular 3G to simulate slow image loading
  • masonry grid items will be overlapping once images load

Markup and masonry options:

<div masonry="{ percentPosition: true, columnWidth: '.masonry-sizer', itemSelector: '.masonry-brick' }">
    <div class="masonry-sizer"></div>
    <div class="masonry-brick" ng-repeat="card in posts track by $index">
</div>

Temporary solution

For anyone looking for a temporary solution: I solved it by disabling the in-built imagesLoaded functionality (setting attribute load-images="false" on the masonry element) and implementing image loading logic with imagesLoaded in a separate directive, calling $scope.$broadcast("masonry.reload") on image load.

jamesjwarren avatar Jul 15 '15 13:07 jamesjwarren

I fixed it by setting the image size explicitly.

In my controller I grab the width of the masonry grid-sizer:

vm.imageWidth = angular.element(".masonry-grid-sizer")[0].clientWidth;

And in my view I calculate the height based on the original image dimensions:

height="{{(view.imageWidth / record.asset[0].width) * record.asset[0].height}}"

danielsmink avatar Aug 20 '15 07:08 danielsmink

Same issue here no fix made until now ?

Benraay avatar Aug 18 '16 15:08 Benraay

I faced the same issue and applied min height to the div after images are loaded ,bricks are reloaded.

kapilgorve avatar May 11 '17 08:05 kapilgorve