漂亮的提示框SweetAlert使用教程

一、简介

   所使用过的弹出框插件,SweetAlert是最好用的。发展至今,已经有两个版本,一个是原版 /sweetalert , 一个是分支版 /sweetalert2 ,更新相对较快,听说更好看。

  SweetAlert是一款不需要jQuery支持的原生js提示框,风格类似bootstrap。现在都已经升级到2.0

  它的提示框不仅美丽动人,并且允许自定义,支持设置提示框标题、提示类型、内容展示图片、确认取消按钮文本、点击后回调函数等。

  使用非常简单,示例如下

  

swal("Hello world!");

swal("Here's the title!", "...and here's the text!"); //包含子标题

swal("Good job!", "You clicked the button!", "success");//包含图标

二、t4t5/sweetalert

github地址:https://github.com/t4t5/sweetalert

官方文档: https://sweetalert.js.org/docs/

中文:

http://mishengqiang.com/sweetalert/

http://mishengqiang.com/sweetalert/

http://www.sucaihuo.com/jquery/12/1241/demo/

文档中没有浏览器兼容提示,只能自己测试了

三、limonte/sweetalert2

github地址:https://github.com/limonte/sweetalert2

在线实例:https://limonte.github.io/sweetalert2 

中文:http://www.jq22.com/jquery-info8169

  

浏览器兼容

IE11*EdgeChromeFirefoxSafariOperaAndroid Browser*UC Browser*
:white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:

* ES6 Promise polyfill should be included, see usage example.

SweetAlert2 不再支持ie10及以下版本

原文地址:https://www.cnblogs.com/xcsn/p/7803578.html