1

在 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');
}
});
4

1 回答 1

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);
}
于 2013-04-19T15:52:54.183 回答