迹忆博客——SweetAlert Examples
swal("迹忆博客_只显示title!");
swal("这里是Title!","此处是文本,是不是也很有意思!");
swal("Very Good!","恭喜您,这么容易就成功了!","success" );
swal("Unfortunately!","很遗憾,操作失败了。嗯,不要灰心!","error" );
swal("Info!","迹忆博客提示您,这里是弹出的提示信息!","info" );
swal("Warning!","迹忆博客提示您,这里是弹出的警告信息!","warning" );
swal({ title: "确定要删除吗?", text: "删除以后无法再对数据进行恢复了!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "删除", cancelButtonText: "取消", closeOnConfirm: false }, function(){ swal("删除成功!", "恭喜,数据删除成功!.", "success"); });
swal({ title: "确定要删除吗?", text: "删除以后无法再对数据进行恢复了!", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "删除", cancelButtonText: "取消", closeOnConfirm: false closeOnCancel: false }, function(isConfirm){ if (isConfirm) { swal("删除成功!", "恭喜,数据删除成功!.", "success"); } else { swal("取消操作!", "您的数据暂时还是安全的 :)", "error"); } });
swal({ title: "Sweet!", text: "这是自定义的图标!", imageUrl: "Images/thumbs-up.jpg", })
swal({ title: "自动关闭提示框!", text: "设置2秒后自动关闭!", timer: 2000, showConfirmButton: false, })
swal({ title: "输入框", text: "在输入框中输入一些信息吧!", type: "input", showCancelButton: true, closeOnConfirm: false, inputPlaceholder: "输入信息", }, function(inputValue){ if (inputValue === false) return false; if (inputValue === "") { swal.showInputError("内容不能为空,请输入一些信息!"); return false } swal("Good!", "您输入的是: " + inputValue, "success"); });
swal({ title: "HTML <small>Title</small>!", text: "自定义的<span style="color:#F8BB86">html<span>内容!", html: true, })
swal({ title: "Ajax 使用示例", text: "提交ajax请求!", type: "info", showCancelButton: true, closeOnConfirm: false showLoaderOnConfirm: true }, function(){ setTimeout(function(){ swal("Ajax 请求完成!"); }, 2000); });
swal({ title: "Animation动画", text: "我是从上面掉下来的!", type: "info", animation: "slide-from-top", });
swal({ title: "allowOutsideClick", text: "不用点击我了,点击我以外的区域我也会消失的!", type: "info", allowOutsideClick: true, showConfirmButton: false, });
swal({ title: "allowEscapeKey", text: "不用点击我了,按下键盘上的ESC键我就消失了!", type: "info", allowEscapeKey: true, showConfirmButton: false, });
sweeatert官方文档:http://t4t5.github.io/sweetalert