jquery - About loading images using masonry.js -


recently, write project needs load items "pinterest". use masonry -- jquery plugin.

but problem is, plugin runs after images loaded, because needs calculate size of items , reposition them. leads problem is: if images fail load, plugin not run or calculate in wrong way. has experience can give me help?

var $container = $('#tweetbox');  $container.imagesloaded( function(){    $container.masonry({      itemselector : '.each_tweet'    });    $('.fancy img').each(function(){      var $this = $(this),          url = $this.attr('alt');      $this.attr('src',url);    });  }); 

thank !

i found solution: use lazy load images load blank image first. after images loaded re-trigger masonary


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -