JS 瀑布流

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 

<script type="text/javascript" src="http://luxury.bjhoutai.com/js/jquery-1.8.2.min.js"></script> 

<script src="http://img.zjhm.com/0Allppzt/js/jquery.waterfall.js"></script> 

<style>

*{ margin:0; padding:0;}

body { font:12px/1.5 Arial; color:#666; background:#EDEDED;}

ul,li{ list-style:none;}

a{ color:#666; text-decoration:none;}

a:hover{ text-decoration:none; color:#000;}

img{border:0 none;}

#waterfall{ text-align:center; width:1000px; margin:0 auto;}

#waterfall img{ width:203px;}

#waterfall .cell{ padding:10px 0px 5px 0px; width:223px;border:1px solid #E3E3E3; background:#fff; margin-top:20px;box-shadow: 0px 2px 3px 1px #ccc;}

#waterfall .cell:hover{box-shadow: 0px 2px 3px 1px #999;}

</style>

</head> 

<body>

<div id="waterfall">

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0101_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0102_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0103_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0104_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0201_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0202_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0203_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0204_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0101_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0102_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0103_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0104_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0201_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0202_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0203_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0204_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0101_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0102_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0103_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0104_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0201_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0202_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div>

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0203_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

    <div class="cell"><a href="#"><img src="http://img.zjhm.com/newluxury/images/jdt0204_660×372.jpg" /></a><p><a href="http://sc.chinaz.com/jiaoben/">MRT</a></p></div> 

</div>

<script>

var opt={

  getResource:function(index,render){//index为已加载次数,render为渲染接口函数,接受一个dom集合或jquery对象作为参数。通过ajax等异步方法得到的数据可以传入该接口进行渲染,如 render(elem)

 if(index>=7) index=index%7+1;

 var html=‘‘;

 for(var i=20*(index-1);i<20*(index-1)+20;i++){

var k=‘‘;

for(var ii=0;ii<3-i.toString().length;ii++){

       k+=‘0‘;

}

k+=i;

    var src="http://img.zjhm.com/newluxury/images/jdt0"+parseInt(Math.random()*(2-1+1)+1)+"0"+parseInt(Math.random()*(4-1+1)+1)+"_660×372.jpg";

html+=‘<div class="cell"><a href="#"><img src="‘+src+‘" /></a><p>mrt</p></div>‘;

 }

 return $(html);

  },

  auto_imgHeight:true,

  insert_type:1

}

$(‘#waterfall‘).waterfall(opt);

</script> 

</body>

</html>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。