简体   繁体   English

jQuery如何完全删除进度条或对话框

[英]jquery how to Completely delete the progress bar or dialog

I added a progressbar when my app raise ajax application, this progress bar was prompted by a dialog, I write below code in ajaxStop function: 当我的应用程序启动ajax应用程序时,我添加了一个进度条,该进度条由对话框提示,我在ajaxStop函数中编写以下代码:

progressbarDialog.dialog("close");
progressbar.progressbar("close");
this.appendDOM.empty(); `

It works well when the first ajax happens, but from the second time, a dialog and progresss bar display un-normal, a blank part will show under the normal part, I think the dialog may be not deleted but hided, can anyone explain this issue? 当第一个ajax发生时,它运行良好,但是从第二次起,对话框和进度条显示不正常,正常部分下方将显示空白部分,我认为对话框可能不会被删除而是被隐藏,任何人都可以解释一下问题? how can the dialog/progress bar total be deleted? 如何删除对话框/进度条总数?

version 2: 版本2:

progressbarDialog.dialog('destroy').remove();

do works, but my dialog is a modal dialog, when I raise application more and more time, the back-ground color will become more and more dark~~~~ below is my function, can anyone help me~ 确实可以,但是我的对话框是模式对话框,当我增加应用程序的时间时,背景色会越来越暗~~~~下面是我的功能,谁能帮我〜

GSMProgressBar.prototype.showProgressBar = function(){ this.appendDOM.empty(); GSMProgressBar.prototype.showProgressBar = function(){this.appendDOM.empty(); this.appendDOM.prepend(""); this.appendDOM.prepend(“”);
var progressbar = $( "#progressBarDialog #progressbar" ); var progressbar = $(“ #progressBarDialog #progressbar”);
var progressbarDialog = $("#progressBarDialog"); var progressbarDialog = $(“#progressBarDialog”); $(document).ajaxStart(function(){ $(document).ajaxStart(function(){
var timeoutOption; var timeoutOption; if(this.config='fast'){ timeoutOption = 300; if(this.config ='fast'){timeoutOption = 300; }else if(this.config='slow'){ timeoutOption = 800; }否则if(this.config ='slow'){timeoutOption = 800; }else{ //default 250 timeoutOption = 500; } else {//默认为250 timeoutOption = 500; } progressbar.progressbar({value:false}); } progressbar.progressbar({value:false}); function progress() { var val = progressbar.progressbar( "value" ) || 函数progress(){var val = progressbar.progressbar(“ value”)|| 0; 0; if ( val < 75 ) { progressbar.progressbar( "value", val + Math.random() * 25 ); 如果(val <75){progressbar.progressbar(“ value”,val + Math.random()* 25); } }
if(val<99){ setTimeout( progress, timeoutOption ); if(val <99){setTimeout(progress,timeoutOption); } } }}
setTimeout( progress, 10 ); setTimeout(progress,10); progressbarDialog.dialog({ modal: true, height: 110, width: 400 }); progressbarDialog.dialog({modal:true,height:110,width:400}); $(".ui-dialog-titlebar").hide(); $(“。ui-dialog-titlebar”)。hide();
}); }); $(document).ajaxStop(function(){ progressbarDialog.dialog('destroy').remove(); }); $(document).ajaxStop(function(){progressbarDialog.dialog('destroy')。remove();}); }; };

try changing: 尝试更改:

progressbarDialog.dialog("close");

to

progressbarDialog.dialog('destroy').remove();

this destroys the dialog and removes the element that holds the dialog 这会破坏对话框并删除保存对话框的元素

Try: 尝试:

$("#YOUR_PROGRESS_BAR_ID").remove();

NOTE: Make sure that you are initializing progressbar after deleting from DOM. 注意:确保从DOM中删除后正在初始化进度栏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM