为了账号安全,请及时绑定邮箱和手机立即绑定

帮我看下,为什么我使用链式调用时,函数不会执行,为什么?

帮我看下,为什么我使用链式调用时,函数不会执行,为什么?

请让我安静一会儿 2018-12-16 13:00:37
function getComputer(obj,attr){     if(obj.currentStyle){         return obj.currentStyle[attr];     }else{         return getComputedStyle(obj,false)[attr];     } } function startMove(obj,attr,target,fn) {         clearInterval(obj.timer);     obj.timer=setInterval(function(){         if(attr=="opacity"){             var cur=Math.round(parseFloat(getComputer(obj,attr))*100);         }else{             var cur=parseInt(getComputer(obj,attr));         }         var speed=target-cur;         speed>0 ?(speed=Math.ceil(speed/3)):(speed=Math.floor(speed/3));         if(cur==target){             clearInterval(obj.timer);             if(fn){                 fn();             }         }else{             if(attr=="opacity"){                 // obj.style.filter=Alpha("opacity:'+(cur+speed)+");                 obj.style.opacity=(speed+cur)/100;             }else{                 obj.style[attr]=cur+speed+"px";             }         }     },300) }
查看完整描述

1 回答

?
聪明的汤姆

TA贡献112条经验 获得超33个赞

请问你哪里使用了链式调用?

查看完整回答
反对 回复 2018-12-17
  • 1 回答
  • 0 关注
  • 730 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信