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 仙桃小白菜 阅读(...) 评论(...) 编辑 收藏