页面初始化时显示进度条

var etControl = {};
etControl.process = function (config) {
    /*需要放在html中的body标签后面使用本控件*/

    var count = 0;
    var id = "loading";
    var el = "#" + id;

    $("body").append('<div id="' + id + '"></div>');

    var divTxt = "#" + id + " #div1";
    $(el).html("<div style='width:99%;height:45%;'></div><div style='width:200px;height:16px;border:1px #CCC solid;margin:auto;'><div id=\"div1\"></div></div>");
    $(el).attr("style", "width: 100%;height: 100%;background: #FFF;padding: 5px;position: fixed;left: 0;top: 0;font-size:12px;z-index:999;");
    $(divTxt).attr("style", "width: 1px;height: 16px;background: #F1FF4D;");

    /*更新进度条*/
    this.updateProcess = function (percent) {
     
        setTimeout(function () { $(divTxt).animate({ width: percent * 2 + "px" },200).text(percent + "%") }, ++count * 200);
        if (percent == 100) {           /*100%就从页面移除loading标签*/
            setTimeout(function () {
                $(el).hide(500);
                setTimeout(function () { $(el).remove() }, 500);
            }, count * 300 + 200);
        }
    };
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值