jquery masonry images are overlapping until a page resize is done

前端 未结 2 1887
情深已故
情深已故 2021-02-08 04:54

I\'ve found this template that demonstrates the issue I\'m having with jquery masonry and image layout. Take a look at this twitter bootstrap template page:

The very fi

2条回答
  •  孤城傲影
    2021-02-08 05:24

    Use imagesLoaded() to triggered masonry after all images are loaded. (imagesLoaded() is provided by the script http://github.com/desandro/imagesloaded.)

    $('.gallery-masonry').imagesLoaded( function(){
      $('.gallery-masonry').masonry({
       itemSelector: '.item',
       isAnimated: true,
       isFitWidth: true
      });
    });
    

提交回复
热议问题