themes - Masonry images overlapping -
so i'm working on tumblr theme right now. i'm using masonry have posts in 5-column grid , infinite scroll script load new images grid when i'm scrolling down. unfortunately, of time scroll down images overlapping. figured out problem may masonry triggering before images loaded, right have no idea how fix this. i'm using (window).load instead of (document).ready pictures keep overlapping nonetheless. here's full code snippet:
<script type="text/javascript" src="http://static.tumblr.com/imovwvl/djwl20ley/jqueryformasonry.js"></script> <script type="text/javascript" src="http://static.tumblr.com/imovwvl/rsgl20lfv/masonry.js"> </script> <script src="http://static.tumblr.com/df28qmy/shulh3i7s/jquery.infinitescroll.js"></script> <script src="http://static.tumblr.com/thpaaos/llwkowcqm/jquery.masonry.js"></script> <script type="text/javascript"> $(window).load(function () { $('.posts').masonry(), $('.masonrywrap').infinitescroll({ navselector : "div#navigation", // selector paged navigation (it hidden) nextselector : "div#navigation a#nextpage", // selector next link (to page 2) itemselector : ".entry", // selector items you'll retrieve bufferpx : 10000, extrascrollpx: 11000, loadingimg : "", loadingtext : "<em></em>", }, // call masonry callback. function() { $('.posts').masonry({ appendedcontent: $(this) }); } ); }); </script> <script type="text/javascript">$(window).load(function(){$("p").remove(":contains('source:')");});</script>
does have idea on how working? appreciated!
masonry placing items absolutely before images have loaded , take more space. utilize jquery imagesloaded overcome this. may want hide elements , show them after have finished loading. try this:
//wire masonry onto photolist whatever defaults need $photolist.imagesloaded(function () { $photolist.masonry({ // options itemselector: '.photo', columnwidth: 226, isfitwidth: true, gutterwidth: 12 }); });
Comments
Post a Comment