function start(obj,json,funct){
var flag=true;
clearInterval(obj.timer);
obj.timer=setInterval(function(){
for(attr in json){
var current;
if(attr=="opacity"){
current=Math.round(parseFloat(getStyle(obj,attr)));
}
else{
current=parseInt(getStyle(obj,attr))
}
var speed=(json[attr]-current)/5;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
if(current!=json[attr]){
flag=false;
if(attr=="opacity"){
obj.style.filter="alpha(opacity:"+(current+speed)+")";
obj.style.opacity=(current+speed)/100;
}
else{
obj.style[attr]=current+speed+"px";
}
}
if(flag){
clearInterval(obj.timer);
if(funct){
funct();
}
}
}
},50)
}
function getStyle(obj,name){
if(obj.currentStyle){
return obj.currentStyle[name];
}
else{
return getComputedStyle(obj,null)[name];
}
}
136

被折叠的 条评论
为什么被折叠?



