根据百分比设置宽度
程序员文章站
2022-05-11 11:49:54
...
var grid_width;
var grid_init=false;
function caculate_grid_width_func(){
var tabPanel = $('#documentlist').closest('.tabs-panels');
if(tabPanel.length>0){
grid_width = tabPanel.width();
}else{
grid_width=$('#documentlist').width();
}
}
/**设置百分比*/
function count_width_func(columnWidth){
var result = 128;
var diff = 0;
columnWidth=null==columnWidth||''==columnWidth||'100%'==columnWidth?'128':columnWidth;
if ( $.browser.msie ){
if('9.0'==$.browser.version )
diff=3;
else if('8.0'==$.browser.version )
diff=3;
else
diff=6;
}
else if($.browser.chrome)
diff=5;
else
diff=2;
if(columnWidth.indexOf('%')>0){
columnWidth=columnWidth.replace('%','')*1;
result=grid_width*columnWidth/100;
}
else if(columnWidth.indexOf('px')>0){
columnWidth=columnWidth.replace('px','');
result=columnWidth;
}
else
result=columnWidth;
return Math.ceil(result)-diff;
}
var grid_init=false;
function caculate_grid_width_func(){
var tabPanel = $('#documentlist').closest('.tabs-panels');
if(tabPanel.length>0){
grid_width = tabPanel.width();
}else{
grid_width=$('#documentlist').width();
}
}
/**设置百分比*/
function count_width_func(columnWidth){
var result = 128;
var diff = 0;
columnWidth=null==columnWidth||''==columnWidth||'100%'==columnWidth?'128':columnWidth;
if ( $.browser.msie ){
if('9.0'==$.browser.version )
diff=3;
else if('8.0'==$.browser.version )
diff=3;
else
diff=6;
}
else if($.browser.chrome)
diff=5;
else
diff=2;
if(columnWidth.indexOf('%')>0){
columnWidth=columnWidth.replace('%','')*1;
result=grid_width*columnWidth/100;
}
else if(columnWidth.indexOf('px')>0){
columnWidth=columnWidth.replace('px','');
result=columnWidth;
}
else
result=columnWidth;
return Math.ceil(result)-diff;
}
上一篇: Redis set 何时会 Failed ( set 操作失败)
下一篇: ci中在哪扩展核心控制器