layer倒计时弹框/弹层 DEMO

layer.msg("提示语...", {
    time: 5000,
    shade: 0.6,
    success: function (layero, index) {
        var msg = layero.text();
        var i = 5;
        var timer = null;
        var fn = function () {
            layero.find(".layui-layer-content").text(msg + '(' + i + ')');
            if (!i) {
                layer.close(index);
                clearInterval(timer);
            }
            i--;
        };
        timer = setInterval(fn, 1000);
        fn();
    },
}, function () {
    //这里写需要执行的
});

源代码来自:http://fly.layui.com/jie/1950/  用户geloom

posted @ 2018-02-07 13:10  陈哲Gilbert  阅读(2918)  评论(0编辑  收藏  举报