除了將 closeOnEscape 設為 false,讓使用者按「ESC」鍵,無法關閉對話視窗。
也須移除右上角的「x」關閉按鈕,
但內建似乎無相關的設定。
所以改用css將「x」關閉按鈕隱藏。
JS設定如下:
$("#dialog").dialog({
autoOpen: true,
height: 80,
width: 180,
modal: true,
closeOnEscape: false,//按ESC不能關閉
open: function(event, ui) {
//隱藏「x」關閉按鈕
//$(this).parent().children().children('.ui-dialog-titlebar-close').hide();
$(this).parent().find('.ui-dialog-titlebar-close').hide();
}
});
效果如下:
好用~感謝你
回覆刪除