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)
}
幫我看下,為什么我使用鏈?zhǔn)秸{(diào)用時(shí),函數(shù)不會(huì)執(zhí)行,為什么?
請讓我安靜一會(huì)兒
2018-12-16 13:00:37