一、簡介
所使用過的彈出框插件,SweetAlert是最好用的。發展至今,已經有兩個版本,一個是原版
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* | Edge | Chrome | Firefox | Safari | Opera | Android Browser* | UC Browser* |
---|---|---|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
* ES6 Promise polyfill should be included, see usage example.
SweetAlert2 不再支持ie10及以下版本