【发布时间】:2018-08-10 21:43:24
【问题描述】:
我正在尝试延迟 SweetAlert 弹出窗口,使其在触发后几秒钟内不显示。
例如用户在网页上执行操作以触发 SweetAlert,但不是立即显示,而是等待 2 秒然后显示。 - 我一直在研究各种方法来做到这一点,但没有运气...我想也许需要setTimeout?
这是我目前正在使用的 SweetAlert 函数:
if( response == 10 ){
swal({
type: 'success',
title: 'YOUR BALANCED BOX IS FULL',
text: 'Youve added the recommended amount of items for your plan!',
allowOutsideClick: false,
showCancelButton: true,
cancelButtonText: "Modify Selection",
cancelButtonColor: '#d33',
showConfirmButton: true,
confirmButtonColor: '#61ce70',
confirmButtonText: "Proceed To Cart",
}).then((result) => {
if (result.value) {
window.location = "/basket/";
}
})
}
任何帮助表示赞赏!
【问题讨论】:
-
setTimeout 会为此工作吗?
标签: javascript alert sweetalert sweetalert2