SweetAlert 弹出对话框

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

SweetAlert 弹出对话框_第1张图片
sweetalert.gif

使用方法

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



最基本的调用方法:

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");
});

可用参数

SweetAlert 弹出对话框_第2张图片
QQ图片20171209095503.png

你可能感兴趣的:(SweetAlert 弹出对话框)