Freewall需要jQuery或Zepto框架。 它需要支持CSS3的浏览器才能获得一些不错的动画效果。
<!DOCTYPE html> <html> <head> <title> freewall demo getting started</title> <script src="js/jquery-1.10.2.min.js"></script> <script src="../freewall.js"></script> <style type="text/css"> #container { width: 80%; margin: auto; } .item { background: rgb(135, 199, 135); width: 320px; height: 320px; } </style> </head> <body> <div id="container"> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> <div class="item"></div> </div> <script> $(function() { var wall = new Freewall("#container"); wall.fitWidth(); }); </script> </body> </html>