bdl*_*bdl 4 ajax jquery jquery-ui modal-dialog
我试图通过ajaxStart,ajaxStop/ajaxComplete事件使用jQuery UI模式对话框作为加载指示器.当页面触发时,Ajax处理程序会加载一些数据,并且模态对话框显示正常.但是,在Ajax事件完成时,它永远不会隐藏或关闭对话框.这是返回的本地服务器的一小部分代码,因此实际的Ajax事件非常快.
这是模态div的实际代码:
$("#modalwindow").dialog({
modal: true,
height: 50,
width: 200,
zIndex: 999,
resizable: false,
title: "Please wait..."
})
.bind("ajaxStart", function(){ $(this).show(); })
.bind("ajaxStop", function(){ $(this).hide(); });
Run Code Online (Sandbox Code Playgroud)
Ajax事件只是一个简单的vanilla $.ajax({})GET方法调用.
基于某些搜索在这里和谷歌,我试着改变ajaxStop处理程序使用$("#modalwindow").close(),$("#modalwindow").destroy()等(#modalwindow这里称为给予明确的情况下).
我也尝试过使用这个标准$("#modalwindow").dialog({}).ajaxStart(....
我应该将事件绑定到不同的对象吗?或者在$.ajax()完整的活动中召唤他们?
我应该提一下,我正在测试最新的IE8,FF 3.6和Chrome.所有都具有相同/相似的效果.
找到答案:
$("#modalwindow").dialog({
modal: true,
height: 50,
width: 200,
zIndex: 999,
resizable: false,
title: "Please wait..."
})
.bind("ajaxStart", function(){
$(this).dialog("open"); })
.bind("ajaxStop", function(){
$(this).dialog("close");
});
Run Code Online (Sandbox Code Playgroud)
自我注意:RTFM.
当然,在所有这些中,现在我意识到它打开和关闭的速度很快就没用了.哦,希望有人会觉得这很有帮助.
| 归档时间: |
|
| 查看次数: |
6751 次 |
| 最近记录: |