app预加载,可视化百分比

来源:互联网 发布:js 数组的长度 编辑:程序博客网 时间:2024/06/02 02:56

昨天正好碰到一同学在问相关的预加载,正好分享工作中用到的app预加载,可视化百分比,已经定义多个加载前后函数的方法。

 网上可下载aepto自带html5loader()方法 zepto.html5Loader.min

var firstLoadFiles = {                    "files": [                        {                            "type": "IMAGE",                            "source": "assets/images/bg/1.png",                            "size": 1                        }]}$.html5Loader({                    filesToLoad: firstLoadFiles,//预加载                     onBeforeLoad: function () { },                    onComplete: function () {                         $.html5Loader({filesToLoad: thenLoadFiles});//加载完成后执行                      },                     onElementLoaded: function (obj, elm) { },                    onUpdate: function (percentage) {                        if(percentage<100){                            console.log(percentage);                            //context.animation();                            context.$(".part_3").html(percentage);//可视化动态加载百分比                         }                    }})


原创粉丝点击