Home  >  Article  >  Web Front-end  >  增强用户体验友好性之jquery easyui window 窗口关闭时的提示_jquery

增强用户体验友好性之jquery easyui window 窗口关闭时的提示_jquery

WBOY
WBOYOriginal
2016-05-16 17:52:161021browse

我的弹窗是这么写的

复制代码 代码如下:

$('#aa').click(function(){ //按钮单击事件
  $('#w').window({//窗口初始化
    title:'随便点',width:400,height:300,iconCls:'icon_add',
    //重要的部分
    onBeforeClose:function(){ //当面板关闭之前触发的事件
      if (confirm('窗口正在关闭,请确认您当前的操作已保存。 是否继续关闭窗口?')) {
        $('#w').window('close', true); //这里调用close 方法,true 表示面板被关闭的时候忽略onBeforeClose 回调函数。
      } else
        return false;
    }
  });
});

这样就OK啦,在点击红X 或者取消|关闭之类的按钮的时候就弹出confirm 窗口点确定关闭window,点取消保留window.
如果不想弹出提示,就直接调用:$('#w').window('close', true)
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn