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

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)
}


请让我安静一会儿
浏览 735回答 1
1回答

聪明的汤姆

请问你哪里使用了链式调用?
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5