代码改变世界

layer倒计时弹框/弹层 DEMO

2018-02-07 13:10 by 仙桃小白菜, ... 阅读, ... 评论, 收藏, 编辑
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

Copyright © 2015 仙桃小白菜

鄂ICP备15002168号-1

鄂公网安备 42900402000102号