漂亮的提示框SweetAlert使用教程


一、簡介

   所使用過的彈出框插件,SweetAlert是最好用的。發展至今,已經有兩個版本,一個是原版 t4t5/sweetalert , 一個是分支版 limonte/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* Edge Chrome Firefox Safari Opera Android 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及以下版本

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM