当前位置:网站首页>JS progress bar, displaying the loading progress
JS progress bar, displaying the loading progress
2022-04-23 14:17:00 【Ruirui junior】
One : introduce ImgPreloader.js
(function() {
function Preloader(srcs, opts) {
this.srcs = srcs;
this.opts = opts ||{};
this.loaded = [];
this.load();
}
Preloader.prototype.load = function() {
for (var i = 0; i < this.srcs.length; ++i) {
var src = this.srcs[i];
this.loadImg(src);
}
};
Preloader.prototype.loadImg = function(src) {
var that = this;
var img = new Image();
img.onload = function() {
that.onload(img);
};
img.src = src;
};
Preloader.prototype.onload = function(obj) {
this.loaded.push(obj);
if (this.opts.each instanceof Function) {
var percent = this.loaded.length / this.srcs.length;
this.o
版权声明
本文为[Ruirui junior]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231408339096.html
边栏推荐
猜你喜欢

sar命令详解

01-NIO基础之ByteBuffer和FileChannel

什么是云迁移?云迁移的四种模式分别是?

处理 mkdir:无法创建目录“aaa“:只读文件系统

关于NodeJS中JSON5的相关配置和使用

容灾有疑问?点这里

HyperMotion云迁移助力中国联通,青云完成某央企上云项目,加速该集团核心业务系统上云进程

Installation and use of postman pit

使用开源调研工具Prophet是一种什么体验?

Operation instructions of star boundary automatic text translator (advanced version)
随机推荐
mysql 5.1升级到5.68
Redis数据库讲解(一)
JDBC和servlet写CRUD的接口总结
Date的after时间判断
在Clion中给主函数传入外部参数
MySQL数据库讲解(七)
redis数据库讲解二(redis高可用、持久化、性能管理)
某政务云项目业务系统迁移调研实践
修改Firebase Emulators的默认侦听IP
云迁移的六大场景
RecyclerView细节研究-RecyclerView点击错位问题的探讨与修复
倒计时1天~2022云容灾产品线上发布会即将开始
线程组ThreadGroup使用介绍+自定义线程工厂类实现ThreadFactory接口
HyperBDR云容灾V3.3.0版本发布|容灾功能升级,资源组管理功能优化
Some good articles on pthread multithreading
Recyclerview advanced use (II) - simple implementation of vertical drag and drop sorting
線程組ThreadGroup使用介紹+自定義線程工廠類實現ThreadFactory接口
Pass in external parameters to the main function in clion
js 进度条,显示加载进度
Mysql的安装过程(已经安装成功的步骤说明)