Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/447.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 调用函数后关闭时,JQuery UI对话框会减慢进程_Javascript_Jquery - Fatal编程技术网

Javascript 调用函数后关闭时,JQuery UI对话框会减慢进程

Javascript 调用函数后关闭时,JQuery UI对话框会减慢进程,javascript,jquery,Javascript,Jquery,我见过这个类似的问题,但在这个例子中,它没有使用按钮属性,这是我的问题。如何在不使用$this的情况下关闭对话框。调用函数后关闭对话框 看这个演示 var begin = new Date(); $(function() { $( "#dialog-confirm" ).dialog({ resizable: false, height:140, modal: true, buttons: { "Delete all

我见过这个类似的问题,但在这个例子中,它没有使用按钮属性,这是我的问题。如何在不使用$this的情况下关闭对话框。调用函数后关闭对话框

看这个演示

 var begin = new Date();
  $(function() { 
    $( "#dialog-confirm" ).dialog({
      resizable: false,
      height:140,
      modal: true,
      buttons: {
        "Delete all items": function() {
         // $( this ).dialog( "close" ); too slow
            foo();
        },
        Cancel: function() {
          $( this ).dialog( "close" );  too slow
            foo();
        }
      }
    });
  });
你可以触发关闭后,把你的关闭代码后调用foo;或者更好地使用回调函数。 请参阅下面的代码,希望对您有所帮助

var开始=新日期; $function{ $dialog-confirm.dialog{ 可调整大小:false, 身高:140, 莫代尔:是的, 按钮:{ 删除所有项:函数{ //$this。对话框关闭; 傅; }, 取消:功能{ fooclsPopUp; } } }; }; 函数clsPopUp{ $dialog-confirm.dialogclose; } 函数回调{ var end=新日期; alertend-begin/1000; 回调; } 你确定吗

尝试:

而不是:

$( this ).dialog( "close" ); 
$( this ).dialog( "close" );