我在div内部有一个砌体容器,内联样式为display:none
。因为我有一些div,当页面加载时,它会在单击按钮时像幻灯片一样切换。这会干扰砌体测量负载高度的能力,因此砖块会从容器中溢出。
答案 0 :(得分:6)
更新:我的答案的.load()
部分不是应该如何完成的。
请参阅: http://masonry.desandro.com/layout.html#imagesloaded
你可以通过以下方式修复它:
overflow: hidden
添加到.panel
至clear the floated elements内。<script type="text/javascript">
$(document).load(function (){
$('#contain').masonry({
itemSelector: '.item',
columnWidth: 100
});
});
</script>
包含这些修正的版本:http://jsbin.com/oyido4/4