下面是我的代码,我有一个名为dvLoading
的加载div,有人可以告诉我在open属性中显示加载div的位置和方式,并在打开时隐藏它吗?
$("#dialog-edit").dialog({
title: 'Add',
autoOpen: false,
resizable: false,
height: height,
width: width,
/*show: { effect: 'drop', direction: "up" },*/
modal: true,
draggable: true,
open: function (event, ui) {
$(this).load(url);
},
close: function (event, ui) {
$(this).dialog('close');
}
});
由于
答案 0 :(得分:1)
这可能有用。 (未测试) 根据{{3}}文档。
$("#dialog-edit").dialog({
title: 'Add',
autoOpen: false,
resizable: false,
height: height,
width: width,
/*show: { effect: 'drop', direction: "up" },*/
modal: true,
draggable: true,
//This function is launched when your dialog open.
open: function (event, ui) {
//Show the loading div on open.
$("#dvLoading").show();
//adding a callback function wich will be launched after the loading
$(this).load(url,function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
$(this).html(msg + xhr.status + " " + xhr.statusText);
} else $.("#dvLoading").hide();
});
},
close: function (event, ui) {
$(this).dialog('close');
}
});