当前位置:网站首页>js 进度条,显示加载进度
js 进度条,显示加载进度
2022-04-23 14:09:00 【瑞瑞小同学】
一:引入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
版权声明
本文为[瑞瑞小同学]所创,转载请带上原文链接,感谢
https://blog.csdn.net/yr123456654321/article/details/113121273
边栏推荐
猜你喜欢
更改plsql工具栏的图标大小
win10自带Groove音乐不能播放CUE和APE文件的一种曲线救国办法,自己创建aimppack插件包,AIMP安装DSP插件
正则表达式
关于云容灾,你需要知道这些
Pass in external parameters to the main function in clion
关于密匙传递的安全性和数字签名
查询2013年到2021年的数据,只查询到2020的数据,遇到了这个问题所进行的解决办法
Operation instructions of star boundary automatic text translator (advanced version)
回顾2021:如何帮助客户扫清上云最后一公里的障碍?
帆软之单元格部分字体变颜色
随机推荐
Multiple inheritance virtual base exercises
关于云容灾,你需要知道这些
线程间控制之CountDownLatch和CyclicBarrier使用介绍
findstr不是内部或外部命令解决方法
在MAC上安装mysql
多云数据流转?云上容灾?年前最后的价值内容分享
MYSQL一种分表实现方案及InnoDB、MyISAM、MRG_MYISAM等各种引擎应用场景介绍
redis数据库讲解(四)主从复制、哨兵、Cluster群集
VMware installation 64 bit XP Chinese tutorial
云迁移的六大场景
连接公司跳板机取别名
VMware Workstation 无法连接到虚拟机。系统找不到指定的文件
dp-[NOIP2000]方格取数
报表FCRA考试题集及答案(错了11题)
关于Jmeter启动闪退问题
MySQL lock database lock
Research on recyclerview details - Discussion and repair of recyclerview click dislocation
DP energy Necklace
01-NIO基础之ByteBuffer和FileChannel
Jmeter设置环境变量支持在任意终端目录输入jmeter直接启动