我想覆蓋Jquery對話框方法的關閉方法。覆蓋jQuery對話框方法
代碼:
jQuery.Dialog.close = function() {
alert('my close');
}
但它不工作。請幫忙。
我想覆蓋Jquery對話框方法的關閉方法。覆蓋jQuery對話框方法
代碼:
jQuery.Dialog.close = function() {
alert('my close');
}
但它不工作。請幫忙。
你設置錯了。檢查this out以瞭解如何正確執行此操作。
好的,這樣的鏈接並不會帶你到我認爲會的地方。這裏是jqueryui.com的相關位。
closeType:dialogclose
This event is triggered when the dialog is closed.
Code examples
Supply a callback function to handle the close event as an init option.
$('.selector').dialog({
close: function(event, ui) { ... }
});
Bind to the close event by type: dialogclose.
$('.selector').bind('dialogclose', function(event, ui) {
...
});
有一個事件叫beforeClose
,它可以讓你做你想做的事,我想。當它觸發時,可以隱藏對話框,然後返回false,這會阻止對話框實際關閉。
$(".selector").dialog({
beforeClose: function(event, ui) {
$(this).hide();
return false;
}
});
beforeClose:「當對話框嘗試關閉時觸發此事件。如果beforeClose事件處理函數(回調函數)返回false,則關閉將被阻止。」 – 2012-01-16 21:48:00
你到底做下面的活動標籤下? – SLaks 2010-01-03 03:37:42
基本上,我在頁面中有多個對話框。當關閉按鈕被點擊時,我想隱藏那個對話框(不關閉)。所以我想在close時做dialog.hide()。所以我想覆蓋關閉方法 – Soft 2010-01-03 04:00:02
當你說你想隱藏它不關閉它,這是否意味着你想保留的價值?除非你不破壞對話,否則你將能夠保留它。在對話框內的關閉函數中,只需說(#dialogname).hide();並在此之後返回false。 – thegreekgod 2016-10-14 07:38:53