0

这是我目前拥有的,但是,图像被压缩以适应文本宽度的大小。无论我在 html 中指定什么大小,它都不会改变。对这件事有任何启示吗?

$('#append').click(function(){
    var $boxes = $('<div class="box">'+balls($iterator)+'</div>');
    $container.append( $boxes ).masonry( 'appended', $boxes );

});


function balls($i){
    $iterator += 1;
    return '<p>'+$test[$iterator][1][2]+'</p><p><img src="'+$test[$iterator][2]+'" alt="'+$test[$iterator][1][2]+'" height="196" width="319"></a></p>';
}

在此处输入图像描述

4

1 回答 1

0

这应该用 imagesLoaded 插件触发吗?从砌体现场

"If your content contains any images, you’ll want to ensure that Masonry is triggered after all the images your content has loaded"

尝试

$container.append( $boxes ).imagesLoaded( function(){$container.masonry( 'appended', $boxes);});
于 2012-06-22T09:59:29.683 回答