jquery插件实现瀑布流
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Title</title>
</head>
<style>
.container-fluid {
padding: 20px;
}
.box {
margin-bottom: 20px;
float: left;
width:400px;
}
.box img {
width:100%;
}
</style>
<body>
<div id=”masonry” class=”container-fluid”>
<div class=”box”><img src=”http://wxserver.knowway.cn/upload/yingjiatoupiao/chenliezhaopian/suoluetu/5840871504671934.jpg”></div>
<div class=”box”><img src=”http://wxserver.knowway.cn/upload/yingjiatoupiao/chenliezhaopian/suoluetu/6829101504671934.jpg”></div>
<div class=”box”><img src=”http://wxserver.knowway.cn/upload/yingjiatoupiao/chenliezhaopian/suoluetu/3246161504671934.jpg”></div>
<div class=”box”><img src=”http://wxserver.knowway.cn/upload/yingjiatoupiao/chenliezhaopian/suoluetu/3458731504671934.jpg”></div>
<div class=”box”><img src=”http://wxserver.knowway.cn/upload/yingjiatoupiao/chenliezhaopian/suoluetu/8541471504671894.jpg”></div>
…
</div>
<script src=”http://libs.baidu.com/jquery/1.8.3/jquery.min.js”></script>
<script src=”{$yuming}/js/masonry-docs.min.js”></script>
<script>
$(function() {
var $container = $(‘#masonry’);
$container.imagesLoaded(function() {
$container.masonry({
itemSelector: ‘.box’,
gutter: 20,
isAnimated: true,
});
});
});
</script>
</body>
</html>
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/18824.html