如何在执行时临时禁用click功能?

use*_*104 5 javascript jquery javascript-events mouseevent

 $("#prevPage").live("click",function(e) {
.................
});
Run Code Online (Sandbox Code Playgroud)

例如,当用户已经点击prevPage时,其中的语句正在运行,如果用户立即点击它,它将再次触发.但是,我希望click事件触发器只有在它内部的所有语句都完成执行后才会触发,如何实现呢?谢谢.

Gle*_*rie 2

这个或类似的东西怎么样:

<script type="text/javascript">
    // disable command while function is being executed.
    var sample = { 
        isExecuting : 0, 
        doWork : function (e) { 
            if (sample.isExecuting === 1) return;
            sample.isExecuting = 1;
            // do work -- whatever you please
            sample.isExecuting = 0; // say: I'm done!
        }
    };
    // live or bind
    $("#prevPage").bind("click",function(e) {
         sample.doWork(e);
    });
</script>
Run Code Online (Sandbox Code Playgroud)

简单的“屏蔽”可以阻止多个呼叫场景。