怎么把这个变成,瀑布流? 本帖最后由 qqmnme 于 2014-07-13 20:39:00 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script type="text/javascript"> var json=[ {"text":"1","src":"/jscss/demoimg/1.jpg","height":"273"}, {"text":"2","src":"/jscss/demoimg/2.jpg","height":"273"}, {"text":"3","src":"/jscss/demoimg/3.jpg","height":"306"}, {"text":"4","src":"/jscss/demoimg/4.jpg","height":"270"}, {"text":"5","src":"/jscss/demoimg/5.jpg","height":"273"}, {"text":"6","src":"/jscss/demoimg/6.jpg","height":"307"}, {"text":"7","src":"/jscss/demoimg/7.jpg","height":"272"}, {"text":"8","src":"/jscss/demoimg/8.jpg","height":"285"}, {"text":"9","src":"/jscss/demoimg/9.jpg","height":"303"}, {"text":"10","src":"/jscss/demoimg/10.jpg","height":"272"}, {"text":"11","src":"/jscss/demoimg/5.jpg","height":"273"}, {"text":"12","src":"/jscss/demoimg/7.jpg","height":"273"}, {"text":"13","src":"/jscss/demoimg/3.jpg","height":"280"}]function getSmallDiv(wrap,oD){ var len=oD.length; var h=Infinity; var getD; for(var i=0;i<len;i++){ if(oD.eq(i).height()<h){ h=oD.eq(i).height(); getD=oD.eq(i); } } return getD;} $("button").click(function(){ for(var i=0;i<json.length;i++){ var str; str="<div class=\"content\">"; str+="<img src="+json[i].src+" height="+json[i].height+" alt=\"\" />"; str+="<div class=\"imgcaption\">"+json[i].text+"</div>"; str+="</div>"; getSmallDiv($(".section"),$(".aside")).append(str); }});</script>看了很多例子,不知道从何下手! 瀑布流,有插件可以使用。 你可以网上找找。 自己也可以实现,就是使用ajax来加载html。 新手求教:条件运算符(?)小习题 正则替换......... 我的这个输出怎么是颠倒的啊? DIV中文本样式的问题~~~~~~求助! 大家看下这个AJAX效果是咋做的?! 为什么parseInt把08和09变成了0 根据条件生成的input 为什么在JS中取其value的时候是undefined 一段奇怪的代码 如何让Iframe和一个td完全重合?求高手!立刻散分! innerHTML 和 innerText 有什么区别。 急求鼠标滑动页面跳转的js码编写方法 Extjs 页面清除所有数据
var json=[
{"text":"1","src":"/jscss/demoimg/1.jpg","height":"273"},
{"text":"2","src":"/jscss/demoimg/2.jpg","height":"273"},
{"text":"3","src":"/jscss/demoimg/3.jpg","height":"306"},
{"text":"4","src":"/jscss/demoimg/4.jpg","height":"270"},
{"text":"5","src":"/jscss/demoimg/5.jpg","height":"273"},
{"text":"6","src":"/jscss/demoimg/6.jpg","height":"307"},
{"text":"7","src":"/jscss/demoimg/7.jpg","height":"272"},
{"text":"8","src":"/jscss/demoimg/8.jpg","height":"285"},
{"text":"9","src":"/jscss/demoimg/9.jpg","height":"303"},
{"text":"10","src":"/jscss/demoimg/10.jpg","height":"272"},
{"text":"11","src":"/jscss/demoimg/5.jpg","height":"273"},
{"text":"12","src":"/jscss/demoimg/7.jpg","height":"273"},
{"text":"13","src":"/jscss/demoimg/3.jpg","height":"280"}
]
function getSmallDiv(wrap,oD){
var len=oD.length;
var h=Infinity;
var getD;
for(var i=0;i<len;i++){
if(oD.eq(i).height()<h){
h=oD.eq(i).height();
getD=oD.eq(i);
}
}
return getD;
}
$("button").click(function(){
for(var i=0;i<json.length;i++){
var str;
str="<div class=\"content\">";
str+="<img src="+json[i].src+" height="+json[i].height+" alt=\"\" />";
str+="<div class=\"imgcaption\">"+json[i].text+"</div>";
str+="</div>";
getSmallDiv($(".section"),$(".aside")).append(str);
}
});
</script>看了很多例子,不知道从何下手!