要求

    • 必备知识

      本文要求基本了解 Html/CSS,  JavaScript/JQuery。

    • 开发环境

      Dreamweaver CS6 / Chrome浏览器

    • 演示地址

      演示地址 资料下载

 

测试预览截图(抬抬你的鼠标就可以看到演示地址哦):

程序核心代码看这里:

$(function(){

        function show(){
var colors=["#BA4A3A","#5BB5D6","#8EA83B","#EE5C92","#8AC9B5","#604127","#E8A03B","#AF032D","#000000","#506575"];
var tags=["女人","男人","电影","宝儿","安妮海瑟薇","数码"];
for(var i in colors){
var index = Math.round(Math.random() * 59);
var img="../Public/Pic/test/"+index+".jpg";
var index2=Math.round(Math.random() * (tags.length-1)); //随机获取一个标签 $('#tiles').append(" <li style='background:"+colors[i]+"' class='clearFix'><div style='background:#FFF'><img src='"+img+"' width='230' /></div><p>是一个熊!!不是一个游戏机!!</p><span>#"+tags[index2]+"</span></li> ");
} } //初始化二十条数据
show();
show(); /*瀑布流*/
$('#tiles').imagesLoaded(function() {
var handler = null;
// Prepare layout options.
var options = {
autoResize: true, // This will auto-update the layout when the browser window is resized.
container: $('#main'), // Optional, used for some extra CSS styling
offset: 15, // Optional, the distance between grid items
itemWidth: 230, // Optional, the width of a grid item
direction :'right'
}; //瀑布流布局
function applyLayout() {
$('#tiles').imagesLoaded(function() {
// Destroy the old handler //是否需要销毁旧的布局
if (handler.wookmarkInstance) {
handler.wookmarkInstance.clear();
} // Create a new layout handler. //重新布局瀑布流
handler = $('#tiles li');
handler.wookmark(options); //传入配置参数
});
} //当滚动条高度大于等于最后一个盒子高度 Ajax请求数据
//绑定到scroll事件上 function onScroll(event) {
// Check if we're within 100 pixels of the bottom edge of the broser window.
var winHeight = window.innerHeight ? window.innerHeight : $(window).height(); // iphone fix
var closeToBottom = ($(window).scrollTop() + winHeight > $(document).height() - 100); if (closeToBottom) {
show();
applyLayout(); //执行布局
}
}; // Capture scroll event.
$(window).bind('scroll', onScroll); // Call the layout function.
handler = $('#tiles li'); //获取盒子
handler.wookmark(options); //初始化瀑布流
}); });

Wookmark-jQuery瀑布流插件介绍和下载:http://www.wookmark.com/jquery-plugin/

官方在线演示地址:http://www.wookmark.com/

关于动态的上传图片将到后续的文章中介绍,有兴趣的博友可以多多关注哦!!

“呵呵”结束了,请原谅本童鞋目前”脑残又缺乏”的语言组织能力,欢迎大家来拍砖来劈斧,由于本人水平有限,文章在表述和代码方面如有不妥之处,欢迎批评指正。

如以上文章或链接对你有帮助的话,别忘了在文章结尾处轻轻点击一下 “还不错”按钮或到页面右下角点击 “赞一个” 按钮哦。你也可以点击页面右边“分享”悬浮按钮哦,让更多的人阅读这篇文章。

作者:Li-Cheng
由于本人水平有限,文章在表述和代码方面如有不妥之处,欢迎批评指正。留下你的脚印,欢迎评论哦。你也可以关注我,一起学习哦!

最新文章

  1. SpringNet学习笔记一
  2. unity发布安卓 截图保存到本地
  3. Unity3D核心类型一览
  4. System V进程间通信
  5. 新建搜索bar
  6. (转)前端构建工具gulp入门教程
  7. win8 在哪找画图工具
  8. tomcat异常
  9. EditText文本中用正则匹配是否包含数字,及判断文本只能是纯汉字或纯字母
  10. centos7下用yum安装mysql5.7
  11. linux命令英文缩写的含义(方便记忆)
  12. 59. Spiral Matrix II(中等,同54题)
  13. Spring Boot 使用 AOP 实现页面自适应
  14. php面试题整理(四)
  15. ABP框架系列之三十四:(Multi-Tenancy-多租户)
  16. vim IDE配置
  17. 【代码审计】大米CMS_V5.5.3 SQL注入漏洞分析
  18. 力扣(LeetCode)226. 翻转二叉树
  19. Maven让资源文件处理插件能够解析资源文件中的Maven属性
  20. 使用json.dumps转换django queryset的datatime报错问题解决

热门文章

  1. 关于python logging的 NOTSET 级别
  2. 图解Eclipse中配置Maven并创建Maven的Web工程
  3. Android 模仿微信发送图片 钟罩效果
  4. Foundation-NSRunLoop
  5. git命令行的操作实例教程
  6. day07_雷神_面向对象进阶
  7. E - Evaluate Matrix Sum
  8. Aggregate类型以及值初始化
  9. CentOS BIND9安装及配置
  10. WPF Command CanExecute 触发一次的问题