swal({
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!",
cancelButtonText: "No, cancel plx!",
closeOnConfirm: false,
closeOnCancel: false
},
function(isConfirm){
if (isConfirm) {
swal({
title: "Auto close alert!",
text: "I will close in 2 seconds.",
timer: 0,
showConfirmButton: false
});
alert('asd');
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});

像这段代码,可以实现点击Confirm弹出一个新的SweetAlert框,原来的框会自动关闭,但是当我把function中的代码改成alert('hello')之后,没有调用swal方法,那么虽然alert可以正常执行,但是原来的框就不能自动关闭了。所以想请问下有没有什么方法可以在回调函数中使用自定义方法,但是又能够自动关闭原来的swal弹框。卡很久了,望大家赐教。

执行swal.close() 就可以关闭

最新文章

  1. windows+ant+git+tomcat中ant直接获取git项目部署注意点
  2. 83 parrted-分区和分区大小的调整
  3. 2.3 C#的常量
  4. C/C++入门---运算符
  5. PHP Redis 全部操作方法
  6. 一个统计报表sql问题
  7. Delphi编译的程序,查看控件名称方法
  8. 解决python3 不能引入setuptools
  9. Windows消息队列
  10. 2299 Ultra-QuickSort(归并)
  11. bshare
  12. 使用CefSharp在.Net程序中嵌入Chrome浏览器(一)——简介
  13. sessionStorage & localStorage in-depth
  14. 洛谷P2414 阿狸的打字机【AC自动机】【fail树】【dfs序】【树状数组】
  15. LR-事务
  16. linux 下 iscsi的简单使用
  17. 搭建github静态博客
  18. JMeter常用元器件
  19. ABAP术语-Field
  20. 基于 Python + OpenCV 进行人脸识别,视频追踪代码全注释

热门文章

  1. 常用的Sublime Text插件及安装方法
  2. Webdriver中关于driver.navigate().to()和driver.get()使用的区别
  3. HDU - 2063 过山车(最大匹配数)(模板)
  4. 【转】Android性能优化-过度绘制解决方案
  5. 并不对劲的bzoj4199: [Noi2015]品酒大会
  6. lua 与 c 的相互调用
  7. Bootstrap指定表格字段宽度
  8. UVa 11401 Triangle Counting (计数DP)
  9. node.js在读取文件时中文乱码问题
  10. bzoj 4037: [HAOI2015]数字串拆分【dp+矩阵加速】