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
Post a Comment