在n秒后看到自动关闭SimpleModal的相关帖子(效果很好),但我想在模态内容中显示倒数计时器。这里参考的是自动关闭解决方案。有什么想法吗?
$.modal('<div>HELLO</div>', {
overlayClose: true,
onShow: function() {
var timer;
$('#simplemodal-container').bind({
mouseenter: function() {
clearTimeout(timer);
},
mouseleave: function() {
timer = setTimeout($.modal.close, 1500);
}
})
.trigger('mouseleave');
}
});
答案 0 :(得分:0)
在onShow参数中有这个对我有用:
onShow: function (dialog) {
var modal = this;
$('.messageTimeout', dialog.data[0]).append(message3);
countdow = 59;
setInterval(function() {
$('.messageTimeout', dialog.data[0]).html('You will be logged out in ' + countdow + ' seconds if you do not take any action.');
countdow -= 1;
},1000);
}