2013-03-23 145 views
1

我想創建一個函數,我可以調用它來一個接一個地翻轉多個圖像。關於我在做什麼錯的想法?在此先感謝jquery翻轉多個圖像

function flipImage(totCount, flipCount) { 

    totCount--; 
    var cnt = flipCount; 
    cnt++; 
    var id = '#flip'+cnt; 

    $(id).flip({ 
     speed:400, 
     color: 'red', 
     direction: 'rl', 
     onAnimation: if (cnt > 0){flipImage(totCount, cnt)}, 
     onEnd: function() { 

      $(id).show(400); 
     } 
    }); 
} 
+1

什麼不在代碼中工作? – 2013-03-23 04:06:16

+0

它說在onAnimation語法錯誤:if(cnt> 0){flipImage(totCount,cnt)}, – daved 2013-03-23 04:09:50

+1

是的,這是正確的...它會給你錯誤.. – 2013-03-23 04:11:12

回答

1

不能使用conditions那樣改爲使用。

onAnimation: function(){ 
    if (cnt > 0){flipImage(totCount, cnt)} 
}, 
+0

謝謝先生! – daved 2013-03-23 04:27:24

+0

@daved歡迎兄弟 – 2013-03-23 04:28:39