SweetAlert2-强大的纯Js模态消息对话框插件 -JS/jQuery代码 -演示与下载 -时代Java

SweetAlert2-强大的纯Js模态消息对话框插件 A beautiful and customizable replacement for JavaScript's popup boxes

SweetAlert2

下面是一个默认的浏览器弹出对话框和SweetAlert2对话框的比较效果。

浏览器内置的对话框

Code:
alert('Oops! Something went wrong!')

SweetAlert2

Code:
sweetAlert(
  'Oops...',
  'Something went wrong!',
  'error'
)

Pretty cool huh? SweetAlert2 automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. It's even highly customizeable, as you can see below!

More examples

In these examples, we're using the shorthand function swal.

Modal Types

Input Types

Multiple inputs aren't supported, you can achieve them by using html and preConfirm parameters.
Notice that in preConfirm function you can pass the custom result to resolve():

下载代码说明
X关闭

纯Js SweetAlert2的模态消息对话框特效源码

SweetAlert2是一款功能强大的纯Js模态消息对话框插件。SweetAlert2用于替代浏览器默认的弹出对话框,它提供各种参数和方法,支持嵌入图片,背景,HTML标签等,并提供5种内置的情景类,功能非常强大。需要的朋友们可以下载试试! SweetAlert2是SweetAlert-js的升级版本,它解决了SweetAlert-js中不能嵌入HTML标签的问题,并对弹出对话框进行了优化,同时