php - Can't reload jQuery Masonry -


i got site shows 25 images. i've created button says "load more". buttons pull 25 images php script via ajax. part working fine. problem is, i'm using jquery masonry align images.

right now, calls masonry function when page loaded.

function masonry() {     var $container = $('#fit');     $container.imagesloaded(function () {         $container.masonry({             itemselector: '.masonryimage'         });     }); } 

however, when want call masonry() function afterwards, doesn't work.

if don't call masonry() on load, works fine in ajax function.

any ideas why happens?

calling bulk masonry() again after reload fixed issue me.

$('#fit').append(newitems).masonry('reloaditems').masonry(); 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -