<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<meta charset="utf-8"/>
<title>動畫效果</title>
<head>
<style>
#Books{
width: 1000px;
height: auto;
margin: 0 auto;
}
.container-fluid {
padding: 20px;
}
.box {
margin-bottom: 20px;
float: left;
width: 220px;
}
.box img {
max-width: 100%
}
</style>
<script src="jquery1-11.js"></script>
<script src="jquery.masonry.min.js"></script>
</head>
<body>
<div id="Books">
<div id="masonry" class="container-fluid">
<div class="box"><img src="1.jpg"></div>
<div class="box"><img src="2.jpg"></div>
<div class="box"><img src="3.jpg"></div>
<div class="box"><img src="4.jpg"></div>
<div class="box"><img src="5.jpg"></div>
<div class="box"><img src="6.jpg"></div>
<div class="box"><img src="7.jpg"></div>
<div class="box"><img src="8.jpg"></div>
<div class="box"><img src="9.jpg"></div>
<div class="box"><img src="10.jpg"></div>
<div class="box"><img src="1.jpg"></div>
<div class="box"><img src="2.jpg"></div>
<div class="box"><img src="3.jpg"></div>
<div class="box"><img src="4.jpg"></div>
<div class="box"><img src="5.jpg"></div>
<div class="box"><img src="6.jpg"></div>
<div class="box"><img src="7.jpg"></div>
<div class="box"><img src="8.jpg"></div>
<div class="box"><img src="9.jpg"></div>
<div class="box"><img src="10.jpg"></div>
<div class="box"><img src="1.jpg"></div>
<div class="box"><img src="2.jpg"></div>
<div class="box"><img src="3.jpg"></div>
<div class="box"><img src="4.jpg"></div>
<div class="box"><img src="5.jpg"></div>
<div class="box"><img src="6.jpg"></div>
<div class="box"><img src="7.jpg"></div>
<div class="box"><img src="8.jpg"></div>
<div class="box"><img src="9.jpg"></div>
<div class="box"><img src="10.jpg"></div>
</div>
</div>
<script type="text/javascript">
var $container = $('#masonry');
$container.imagesLoaded(function() {
$container.masonry({
itemSelector: '.box',
gutterWidth: 20,
isAnimated: true
});
});
$(window).scroll(function(){
var scrollTop = $(this).scrollTop();var scrollHeight = $(document).height();var windowHeight = $(this).height();
if(scrollTop + windowHeight == scrollHeight){
$('#masonry').append('<div class="box"><img src="1.jpg"></div><div class="box"><img src="2.jpg"></div><div class="box"><img src="3.jpg"></div> <div class="box"><img src="4.jpg"></div><div class="box"><img src="5.jpg"></div><div class="box"><img src="6.jpg"></div><div class="box"><img src="7.jpg"></div><div class="box"><img src="8.jpg"></div><div class="box"><img src="9.jpg"></div><div class="box"><img src="10.jpg"></div>');
$container.masonry('reload');
}
})
</script>
</body>
</html>