当前位置:网站首页>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
边栏推荐
- 線程組ThreadGroup使用介紹+自定義線程工廠類實現ThreadFactory接口
- Logging module
- Operation instructions of star boundary text automatic translator
- OpenStack如何跨版本升级
- 时间复杂度计算举例
- mysql 5.1升级到5.611
- On September 8, the night before going to Songshan Lake
- 查询2013年到2021年的数据,只查询到2020的数据,遇到了这个问题所进行的解决办法
- Wechat applet positioning and ranging through low-power Bluetooth device (2)
- VMware 15pro mounts the hard disk of the real computer in the deepin system
猜你喜欢

政务云迁移实践 北明数科使用HyperMotion云迁移产品为某政府单位实施上云迁移项目,15天内完成近百套主机迁移

MySQL数据库讲解(十)

win10自带Groove音乐不能播放CUE和APE文件的一种曲线救国办法,自己创建aimppack插件包,AIMP安装DSP插件

Wechat applet initializes Bluetooth, searches nearby Bluetooth devices and connects designated Bluetooth (I)

帆软之单元格部分字体变颜色

MYSQL一种分表实现方案及InnoDB、MyISAM、MRG_MYISAM等各种引擎应用场景介绍

字节面试编程题:最小的K个数

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

MySQL数据库讲解(八)

On the multi-level certificate based on OpenSSL, the issuance and management of multi-level Ca, and two-way authentication
随机推荐
帆软之单元格部分字体变颜色
RecyclerView细节研究-RecyclerView点击错位问题的探讨与修复
线程组ThreadGroup使用介绍+自定义线程工厂类实现ThreadFactory接口
星界边境文本自动翻译机(高级版)使用说明
Some experience of using dialogfragment and anti stepping pit experience (getactivity and getdialog are empty, cancelable is invalid, etc.)
RecyclerView进阶使用-实现仿支付宝菜单编辑页面拖拽功能
回顾2021:如何帮助客户扫清上云最后一公里的障碍?
Wechat applet positioning and ranging through low-power Bluetooth device (2)
按实际取,每三级分类汇总一次,看图知需求
JSP学习2
Get the thread return value. Introduction to the use of future interface and futuretask class
Postman的安装使用及填坑心得
redis数据库讲解(三)redis数据类型
如何快速批量创建文本文档?
postman批量生产body信息(实现批量修改数据)
gzip和gunzip 解压参数详解
如何轻松做好一个项目
关于训练过程中损失函数出现断崖式增长的问题
困扰多年的系统调研问题有自动化采集工具了,还是开源免费的
Wechat applet input hidden and inoperable settings