SOURCE

(function(w)){

w.feizhu = {};

w.feizhu.css = function (node, type , val){
//如果节点node节点个transform 无赋值,就另距等于一个空嘎对象
if(typeof node ==="object" && typeof node["transform"] === "undefined"){
node["transform"]={};

}

//transform: scale,tranlate,rotate
//判断有多少个transform类型,拼串,赋值
//val 是属性值,item是属性
//arguments = 形参,>=3 读写, 2个读取
if(arguments.length>=3){
//设置
var text = "";
node["transform"][type] = val;

for( item in node["transform"]){
    if(node["transform"].hasOwnProperty(item)){
        switch(item){
        case "translateX":
        case "translateY":
       text += item + "("+node["transform"][item]+"px)";
       break;
       case "scale":
        text += item + "("+node["transform"][item]+")";
        break;
        case:"rotate":
         text += item + "("+node["transform"][item]+"deg)";
        }


    }              


}
//赋值
node.style.transform = node.style.webkitTransform = text;


}else if(arguments == 2){
//读取
val = node["transform"][type];
if(typeof val === "undefined"){
  switch (type){
       case "tranlateX":
        case "translateY":
        case:"rotate":
        val = 0;
        break;
        case "scale":
        val = 1;
        break;

  }


  }

return val;
}



}


}














}























}(window)
console 命令行工具 X clear

                    
>
console