瀑布流:css控制布局
<body>
<style type="text/css">.mian{ margin-top:55px;}.wf-main{ position:relative;
margin: 0 auto;
width: 990px;
overflow: hidden;border:1px solid #000;
}
.wf-main .li{
position:absolute;
margin-bottom:10px;
padding:5px 8px;
width: 214px;
line-height:18px;
border: 1px solid#F00;
border-radius:4px;
background-color:#ccc;
overflow: hidden;
}
.li .lk{
position:absolute;
margin-bottom:5px;
width: 73px;
overflow: hidden;
border: 1px solid#f00;
border-radius:3px;
}
.li .title{
margin: 0 0 5px;
padding: 5px;
width: 63px;
color: #f00;
font-size: 14px;
}
</style><div></div><div><divid="wf-main">
<div><h2>1、瀑布流</h2></div>
<div>2<br>2</div>
<div>3<br>4<br>4</div>
<div>4<br>4<br>4<br>4</div>
<div>5<br>4<br>4<br>4<br>4</div>
<div>6<br>4<br>4<br>4<br>4<br>4</div>
<div>7<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>8<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>9<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>10<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>11<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>12<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>13<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div id="wf-inner">
<h2>14、内部瀑布流</h2>
<div>14-1<br>1</div>
<div>14-2</div>
<div>14-3</div>
<div>14-4</div>
<div>14-5<br></div>
<div>14-6</div>
<div>14-7</div>
<div>14-8</div>
<div>14-9</div>
</div>
<div>15<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>16<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>17<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>18<br>2<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>19<br>2<br>2<br>3<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>20<br>4<br>4<br>3<br>3<br>1<br>2<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>21<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>22<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>23<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
<div>24<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4<br>4</div>
</div></div><scripttype="text/javascript">
function Waterfall(param){
this.id = typeofparam.container == 'string' ?document.getElementByIdx_x(param.container) : param.container;
this.colWidth =param.colWidth;
this.colCount =param.colCount || 4;
this.cls = param.cls&& param.cls != '' ? param.cls :'li';
this.init();
}
Waterfall.prototype = {
getByClass:function(cls,p){
var arr = [],reg = new RegExp("(^|\s+)" + cls +"(\s+|$)","g");
var nodes = p.getElementsByTagName_r("*"),len =nodes.length;
for(var i = 0; i < len;i++){
if(reg.test(nodes[i].className)){
arr.push(nodes[i]);
reg.lastIndex = 0;
}
}
return arr;
},
maxArr:function(arr){
var len = arr.length,temp = arr[0];
for(var ii= 1; ii < len;ii++){
if(temp< arr[ii]){
temp = arr[ii];
}
}
return temp;
},
getMar:function(node){
var dis = 0;
if(node.currentStyle){
dis =parseInt(node.currentStyle.marginBottom);
}else if(document.defaultView){
dis =parseInt(document.defaultView.getComputedStyle(node,null).marginBottom);
}
return dis;
},
getMinCol:function(arr){
var ca = arr,cl = ca.length,temp = ca[0],minc =0;
for(var ci = 0; ci < cl;ci++){
if(temp> ca[ci]){
temp = ca[ci]; minc =ci;
}
}
return minc;
},
init:function(){
var _this = this;
var col = [],//列高
iArr =[];//索引
var nodes =_this.getByClass(_this.cls,_this.id),len = nodes.length;
for(var i = 0; i <_this.colCount; i++){
col[i] =0;
}
for(var i = 0; i < len;i++){ nodes[i].h= nodes[i].offsetHeight + _this.getMar(nodes[i]); iArr[i] =i;
}
for(var i = 0; i < len;i++){
var ming =_this.getMinCol(col);
nodes[i].style.left = ming * _this.colWidth + "px";
nodes[i].style.top = col[ming] + "px";
col[ming]+= nodes[i].h;
}
_this.id.style.height = _this.maxArr(col) +"px";
}};
new Waterfall({"container":"wf-inner","colWidth":77,"colCount":3,"cls":"lk"});
new Waterfall({"container":"wf-main","colWidth":244,"colCount":4});</script></body></html>
更多阅读
不见棺材泪不流:《峭壁边缘:拯救世界金融之路》
不见棺材泪不流:《峭壁边缘:拯救世界金融之路》书名:峭壁边缘:拯救世界金融之路On the Brink: Inside the Race to Stop theCollapse of the Global Financial System原著:(美)亨利•保尔森Henry M. Paulson,JR.原版日期:2010.2
摄影虚化技巧:景深控制三要素__海的那边
摄影虚化技巧:景深控制三要素作者:海的那边摄影虚化技巧:景深控制三要素作者:海的那边 虚化一直是广大摄友津津乐道的话题。 说起虚化,大部分情况下它是景深概念的通俗化表达。海的那边以为:影响景深的三要素是:光圈、焦距和
CSS控制内容两边对齐 css字体两边对齐
CSS控制内容两边对齐text-align:justify;text-justify:inter-ideograph;1.中文字两端对齐:text-align:justify;text-justify:inter-ideograph;2.固定宽度汉字截断:overflow:hidden;text-overflow:ellipsis;white-space:nowrap;(不过只
中国经济放缓的原因 盯紧现金流:加快对顾客收款 放缓给供货商付款
有两种方法可以阻止负现金流:加快对顾客的收款速度或延长给供货商的付款时间 令人惊讶的是,每家企业都有能力预测并避免因销售引发的现金流问题。凭着资产负债表和损益表中的几个简单数字,你就完全能够避免可能会出现的问题。
第27节:逆市布局下的投资策略(8)
系列专题:《经济危机下的经营投资策略:逆市布局》 我们认为在2009年,确定性成长类股票主要分布在非周期和高景气度的行业中。结合行业分析师观点,我们认为非周期行业中的医药、科技、教育、公用事业和必需消费品值得关注。而在高景