var $container = $('.carousel_content'); $container.imagesLoaded(function() { $container.masonry({ itemSelector: '.carousel_contentL', columnWidth: 1 //每两列之间的间隙为5像素 }); }); $container.masonry('reload');
这样测试OK
var $container = $('.carousel_content'); // $container.imagesLoaded(function(){ $container.masonry({ itemSelector: '.carousel_contentL', gutter: 1, columnWidth: 1 //每两列之间的间隙为5像素 }); // }); // $container.masonry('reload'); $container.masonry().append($container).masonry('appended', $container).masonry();
这样更好!
js引用
按照这个来你们都没问题吗?一直报 $container.imagesLoaded is not a function