大家好,我对javascript masonry有疑问,这是代码,这只是一个测试件,请帮助我....
我已经尝试过这段代码,但这不起作用请帮助我..提前谢谢..
任何帮助表示赞赏...
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://masonry.desandro.com/jquery.masonry.min.js"> </script>
<script type="text/javascript" src="https://raw.github.com/desandro/imagesloaded/master/jquery.imagesloaded.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var $container = $('.portfolio-container');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector : '.break',
columnWidth : 129
});
});
});
</script>
<style type="text/css">
.break {
float: left;
width: 129px;
margin: 3px;
background-color:blue;
}
.break1{height:30px;}
.break2{height:50px;}
.break3{height:20px;}
.break4{height:70px;}
</style>
</head>
<body>
<div class="portfolio-container">
<?php
for ($i=1; $i<9; $i++){
?>
<div class="break1 break" >
</div><div class="break2 break" >
</div><div class="break3 break">
</div><div class="break4 break" >
</div>
<?php } ?>
</div>
</body>
</html>