美文网首页
SweetAlert 弹出对话框

SweetAlert 弹出对话框

作者: charmingcheng | 来源:发表于2017-12-09 09:57 被阅读0次

中文网址:http://mishengqiang.com/sweetalert/

sweetalert.gif

使用方法

要使用该插件,首先要在html的header中引入以下文件:

<script src="lib/sweet-alert.min.js"></script>
<link rel="stylesheet" type="text/css" href="lib/sweet-alert.css">

最基本的调用方法:

sweetAlert("Hello world!");

带错误图标的警告框:

sweetAlert("Oops...", "Something went wrong!", "error");

一个带有确认按钮的警告框,点击确认按钮可触发动画:

sweetAlert({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
}, function(){
  swal("Deleted!",
  "Your imaginary file has been deleted.",
  "success");
});

可用参数

QQ图片20171209095503.png

相关文章

网友评论

      本文标题:SweetAlert 弹出对话框

      本文链接:https://www.haomeiwen.com/subject/jkduixtx.html