基于PHP、JSON和jQuery实现瀑布流布局

const opt = {
  getResource: function(index, render) {
    // 使用同步AJAX请求获取数据
    const html = $.ajax({
      url: 'water.php?page=' + index,
      async: false
    });
    // 将响应文本解析为DOM片段并返回
    return $(html.responseText);
  },
  column_width: 233, // 列宽
  auto_imgHeight: true, // 自动调整图片高度
  insert_type: 1 // 插入方式
};

// 初始化瀑布流插件
$('#container').waterfall(opt);
rar 文件大小:696.54KB