2012-05-08 73 views
0

是否有可能(以合理的方式)讓一個jQuery UI對話框關閉不同的動畫,具體取決於點擊哪個按鈕?根據按鈕關閉jQuery UI對話框的不同動畫?

$("#dialog").dialog({ 
    autoOpen: false, 
    show: "blind", 
    hide: "explode" 
    buttons: { 
     "Delete": function() { 
      ... one animation here ... 
      $(this).dialog("close"); 
     }, 
     "Cancel" : function() { 
      ... another here ... 
      $(this).dialog("close"); 
     } 
    } 
}); 

回答

3

是的。

$("#dialog").dialog({ 
    //autoOpen: false, 
    show: 'blind', 
    buttons: { 
     Delete: function() { 
      $(this).dialog('option', 'hide', 'explode'); 
      $(this).dialog("close"); 
     }, 
     Cancel : function() { 
      $(this).dialog('option', 'hide', 'blind'); 
      $(this).dialog("close"); 
     } 
    } 
}); 

活生生的例子:http://jsfiddle.net/GLUHa/2/