<!doctype html>
<html lang="en">
<head>
<meta charset="gb2312">
<title>jQuery自适应窗口大小图片排列代码 - 网页模板</title>
<style>
.container:before,
.container:after {
content: "";
display: table;
}
.container:after {
clear: both;
}
.item {
float: left;
margin-bottom: 15px;
}
.item img {
max-width: 100%;
max-height: 100%;
vertical-align: bottom;
}
.first-item {
clear: both;
}
.last-row, .last-row ~ .item {
margin-bottom: 0;
}
</style>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.row-grid.js"></script>
<script>
$(document).ready(function(){
$(".container").rowGrid({itemSelector: ".item", minMargin: 10, maxMargin: 25, firstItemClass: "first-item"});
});
</script>
</head>
<body>
<div class="container">
<div class="item">
<img src="images/2.jpg" width="220" height="200" />
</div>
<div class="item">
<img src="images/1.jpg" width="180" height="200" />
</div>
<div class="item">
<img src="images/3.jpg" width="250" height="200" />
</div>
<div class="item">
<img src="images/4.jpg" width="200" height="200" />
</div>
<div class="item">
<img src="images/5.jpg" width="240" height="200" />
</div>
<div class="item">
<img src="images/6.jpg" width="210" height="200" />
</div>
<div class="item">
<img src="images/7.jpg" width="200" height="200" />
</div>
<div class="item">
<img src="images/8.jpg" width="190" height="200" />
</div>
<div class="item">
<img src="images/9.jpg" width="260" height="200" />
</div>
<div class="item">
<img src="images/10.jpg" width="220" height="200" />
</div>
<div class="item">
<img src="images/11.jpg" width="200" height="200" />
</div>
<div class="item">
<img src="images/12.jpg" width="170" height="200" />
</div>
<div class="item">
<img src="images/13.jpg" width="280" height="200" />
</div>
<div class="item">
<img src="images/14.jpg" width="220" height="200" />
</div>
<div class="item">
<img src="images/15.jpg" width="240" height="200" />
</div>
<div class="item">
<img src="images/16.jpg" width="180" height="200" />
</div>
<div class="item">
<img src="images/17.jpg" width="200" height="200" />
</div>
<div class="item">
<img src="images/22.jpg" width="220" height="200" />
</div>
<div class="item">
<img src="images/1.jpg" width="220" height="200" />
</div>
<div class="item">
<img src="images/2.jpg" width="180" height="200" />
</div>
<div class="item">
<img src="images/3.jpg" width="250" height="200" />
</div>
<div class="item">
<img src="images/4.jpg" width="200" height="200" />
</div>
<div class="item">
<img src="images/5.jpg" width="240" height="200" />
</div>
<div class="item">
<img src="images/6.jpg" width="210" height="200" />
</div>
<div class="item">
<img src="images/7.jpg" width="200" height="200" />
</div>
<div class="item">
<img src="images/8.jpg" width="190" height="200" />
</div>
<div class="item">
<img src="images/9.jpg" width="260" height="200" />
</div>
<div class="item">
<img src="images/10.jpg" width="220" height="200" />
</div>
<div class="item">
<img src="images/11.jpg" width="200" height="200" />
</div>
<div class="item">
<img src="images/12.jpg" width="170" height="200" />
</div>
<div class="item">
<img src="images/13.jpg" width="280" height="200" />
</div>
<div class="item">
<img src="images/14.jpg" width="220" height="200" />
</div>
<div class="item">
<img src="images/15.jpg" width="240" height="200" />
</div>
<div class="item">
<img src="images/16.jpg" width="180" height="200" />
</div>
<div class="item">
<img src="images/17.jpg" width="200" height="200" />
</div>
<div class="item">
<img src="images/22.jpg" width="220" height="200" />
</div>
</div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>适用浏览器:360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. 不支持IE8及以下浏览器。</p>
<p>来源:<a href="http://www.moobnn.com/" target="_blank">网页模板</a></p>
</div>
</body>
</html>