当前位置:网站首页>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
边栏推荐
猜你喜欢
redis数据库讲解二(redis高可用、持久化、性能管理)
多云数据流转?云上容灾?年前最后的价值内容分享
帆软报表设置单元格填报以及根据值的大小进行排名方法
统信UOS PHP7.2.3升级至PHP7.2.24
Installation and use of postman pit
RecyclerView细节研究-RecyclerView点击错位问题的探讨与修复
倒计时1天~2022云容灾产品线上发布会即将开始
MYSQL一种分表实现方案及InnoDB、MyISAM、MRG_MYISAM等各种引擎应用场景介绍
OpenStack如何跨版本升级
HyperMotion云迁移助力中国联通,青云完成某央企上云项目,加速该集团核心业务系统上云进程
随机推荐
On September 8, the night before going to Songshan Lake
快速搞懂线程实现的三种方式
yml引用其他变量
logback-logger和root
elk安装
A table splitting implementation scheme of MySQL and InnoDB, MyISAM and MRG_ Introduction to MyISAM and other engine application scenarios
关于密匙传递的安全性和数字签名
std::map 和 std::vector 内存释放
GFS分布式文件系统(理论)
教育行业云迁移最佳实践:海云捷迅使用HyperMotion云迁移产品为北京某大学实施渐进式迁移,成功率100%
mysql 5.1升级到5.610
VMware installation 64 bit XP Chinese tutorial
dp-能量项链
VMware 15pro mounts the hard disk of the real computer in the deepin system
金融行业云迁移实践 平安金融云整合HyperMotion云迁移解决方案,为金融行业客户提供迁移服务
Multiple inheritance virtual base exercises
利用json-server在本地创建服务器请求
HyperMotion云迁移助力中国联通,青云完成某央企上云项目,加速该集团核心业务系统上云进程
查询2013年到2021年的数据,只查询到2020的数据,遇到了这个问题所进行的解决办法
Essential difference between restful WebService and gSOAP webservice