2017-07-02 152 views
1

我想在用戶放下物品時執行效果。我怎樣才能做到這一點?假設我想使用「反彈」效果。jquery - 元素掉落時如何執行效果

var drop1 = 1; 
var drop2 = 2; 
var liit = 3; 
var counter = 0; 

$('.container').droppable({ 
    accept: '.item', 
    drop: function(event, div) { 

     counter++; 

     // here I would like to put a function that 
     // the dropped element bounces up and down before the alert. 
     if (counter == hit1) { 
      alert("You dropped on item"); 
     } 

     else if (counter == hit2) { 
      alert("You dropped another item"); 
     } 
    } 
}); 
+0

你現在解決問題了嗎? – eeya

回答