无法重新加载jQuery Masonry

I got a site that shows 25 images. I've created a button that says "Load More". The buttons pull 25 images from a php script via Ajax. This part is actually working fine. The problem is, I'm using jquery masonry to align the images.

Right now, it calls the Masonry function when the page is loaded.

function Masonry() {
    var $container = $('#fit');
    $container.imagesLoaded(function () {
        $container.masonry({
            itemSelector: '.masonryImage'
        });
    });
}

However, when I want to call the Masonry() function afterwards, it doesn't work.

If I don't call the Masonry() on load, it works fine in my ajax function.

Any ideas as to why this happens?

查看全部
weixin_33738982
?Briella
2013/05/04 12:46
  • php
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

2个回复