2012-06-20 75 views
2

由於某些原因,當我使用jQTouch pageAnimationStart時,它會被觸發兩次。jQTouch pageAnimationStart兩次觸發

實施例:

$(this).bind('pageAnimationStart', function(e,info) { 
    alert('Animation Started'); 
}); 

警報被調用兩次。有任何想法嗎?

我創建的解決方法似乎工作,如下所示:

var animation_start_count = 0; 

$(document).bind('pageAnimationStart', function(e,info) { 
    animation_start_count ++; 

    if (animation_start_count == 1) { 
     alert('Animation Started'); 
    } 
    else { 
     animation_start_count = 0; 
    } 
}); 

在我的解決方法,該警報將只能調用一次。

我只創建一次jQT對象。小麻煩,但我想知道是否有人遇到這個問題。與pageAnimationEnd同樣的結果。

謝謝!

回答

0

我認爲有兩個pageAnimationStart事件,因爲兩個頁面正在動畫:toPagefromPagepageAnimationEnd也是如此。

這一切都在jqtouch.js的doNavigation方法中。