JS -how返回&重新运行一个功能?

时间:2015-02-02 11:58:43

标签: javascript callback closures call

我有一个onButtonClick函数,当满足某个条件时,我想返回结果(更新浏览器),然后重新运行该函数。

...我这样做的原因是改变转换属性,如果我没有在某种程度上重置旋转将不会连贯......

以下是我的点击功能:

var degree=0,
     axis='Y';

 function onButtonClick(e) {

     var x = this.className.slice(5);


        if (condition === true){
//needs to update browser
           box.style.transform = "translateZ(-"+trans+"px) rotateY(-180deg)";
//now I need to return & rerun this whole function (possibly repeating the call)  
        };


       /* switches and manipulations */


   box.style.transform = "translateZ(-"+ trans +"px) rotate"+ axis +"("+ degree +"deg)";

}

使用此代码,如果满足特定条件,则不会在浏览器中更新,因此在进行转换时,不会修改计算。

0 个答案:

没有答案
相关问题