使用jquery创建自定义警报窗口 [英] Create custom alert window using jquery

查看:71
本文介绍了使用jquery创建自定义警报窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用javascript创建了一个带标题栏,自定义图标和z-index的模态div。我没有使用jquery ui模态。

我可以通过调用函数来显示模态div

 $( document )。ready( function (){
notify = function notify(模式,标题,消息,类型){
createDialog(模式,标题,消息,类型);
}

function createDialog(模式,标题,消息,类型){
// 要创建的代码自定义内容
appendDialog(customHtmlContent);
}

function appendDialog(content){
var body = $( document )。find( ' body');
$(正文).append(内容);
}

$( document )。on(' click' span #closeNotification' function (){
// 删除模式对话框的代码
});

$( document )。on(' click'' span#showNotification' function (){
notify(' mode'' title'' message'' info');
otherFunction();
});
});



但问题是在显示模态对话框后我想暂停javascript代码执行。用户关闭对话框后继续并执行更多javascript代码。



我尝试过:



我还没有尝试过添加此功能的任何内容

解决方案

document )。ready( function (){
notify = function notify(mode ,标题,消息,类型){
createDialog(模式,标题,消息,类型);
}

function createDialog(模式,标题,消息,类型){
// 创建自定义内容的代码
appendDialog(customHtmlContent);
}

function appendDialog(content){
var body =


docu发现)。find(' body');


(主体).append(内容);
}


I have created a modal div with title bar, custom icons and z-index by using javascript. I am not using jquery ui modal.
I can display the modal div by calling a function

$(document).ready(function (){
   notify = function notify(mode, title, message, type) {
     createDialog(mode, title, message, type);
   }

   function createDialog(mode, title, message, type) {
      //code to create custom content
      appendDialog(customHtmlContent);
   }

    function appendDialog(content) {
        var body = $(document).find('body');
        $(body).append(content);
    }

   $(document).on('click','span#closeNotification',function(){
     //code to remove modal dialog
   });

   $(document).on('click','span#showNotification',function(){
     notify('mode','title','message','info');
     otherFunction();
   });
});


But the problem is that after showing the modal dialog i want to halt the javascript code execution. After the dialog is closed by the user continue and execute the further javascript code.

What I have tried:

I have not tried anything as yet to add this functionality

解决方案

(document).ready(function (){ notify = function notify(mode, title, message, type) { createDialog(mode, title, message, type); } function createDialog(mode, title, message, type) { //code to create custom content appendDialog(customHtmlContent); } function appendDialog(content) { var body =


(document).find('body');


(body).append(content); }


这篇关于使用jquery创建自定义警报窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆