jquery masonry 瀑布流 可搭配bootstrap响应式
(1)分别加载jquery插件与jquery.masonry插件两个文件:
<script src="js/jquery.min.js"></script>
<script src="js/jquery.masonry.min.js"></script>
(2)css样式表:
.box {
margin-bottom: 10px;
float: left;
width: 300px;
}
(3)html样式:
<div id="masonry" class="container-fluid">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"</div>
</div>
(4)初始化masonry:
$(function(){
var $container = $(‘#masonry‘);
$container.imagesLoaded( function(){
$container.masonry({
itemSelector : ‘.box‘,
gutterWidth : 20,
isAnimated: true,
});
});
});