目前我已經設定,這樣,回調執行僅去年在堆棧
var elements = $('#one, $two, #three, #four, #six');
var _temp = 0;
elements.hide(0, function(){
/* by default, the callback will be performed to
every single element in stack */
_temp++; // increment temporary cache
// perform actual callback only on last in list
if (_temp == elements.length) {
// do stuff
}
});
但感覺錯了,因爲如果我想爲另一個回調做同樣低於241線,我必須重置_temp
,而且,全局變量只是一團糟。
我怎麼能簡化這個?
'hide'沒有回調作爲第一個參數。這沒有任何意義。 – VisioN 2012-07-18 07:55:34
Woops,是不是從腳本複製粘貼,忘記了0. – jolt 2012-07-18 08:04:04