当前位置:网站首页>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
边栏推荐
- A table splitting implementation scheme of MySQL and InnoDB, MyISAM and MRG_ Introduction to MyISAM and other engine application scenarios
- GFS分布式文件系统(理论)
- mysql查询库大小
- 查询2013年到2021年的数据,只查询到2020的数据,遇到了这个问题所进行的解决办法
- 星界边境文本自动翻译机(高级版)使用说明
- On September 8, the night before going to Songshan Lake
- 报表FCRA考试题集及答案(错了11题)
- Wechat applet communicates with esp8266 based on UDP protocol
- Visio画拓扑图随记
- Postman的安装使用及填坑心得
猜你喜欢
Research on recyclerview details - Discussion and repair of recyclerview click dislocation
A table splitting implementation scheme of MySQL and InnoDB, MyISAM and MRG_ Introduction to MyISAM and other engine application scenarios
关于密匙传递的安全性和数字签名
帆软实现一个单选按钮,可以统一设置其他单选按钮的选择状态
man man随记和crontab的@reboot用法
Gartner预测云迁移规模大幅增长;云迁移的优势是什么?
win10自带Groove音乐不能播放CUE和APE文件的一种曲线救国办法,自己创建aimppack插件包,AIMP安装DSP插件
在MAC上安装mysql
线程组ThreadGroup使用介绍+自定义线程工厂类实现ThreadFactory接口
MySQL数据库讲解(七)
随机推荐
Essential difference between restful WebService and gSOAP webservice
OpenStack命令操作
帆软实现一个单选按钮,可以统一设置其他单选按钮的选择状态
政务云迁移实践 北明数科使用HyperMotion云迁移产品为某政府单位实施上云迁移项目,15天内完成近百套主机迁移
什么是云迁移?云迁移的四种模式分别是?
Get the thread return value. Introduction to the use of future interface and futuretask class
Gartner预测云迁移规模大幅增长;云迁移的优势是什么?
在Clion中给主函数传入外部参数
krpano全景之vtour文件夹和tour
正则表达式
ActiveMQ Basics
MySQL-InnoDB-事务
Jira截取全图
redis数据库讲解(四)主从复制、哨兵、Cluster群集
MySQL数据库讲解(十)
線程組ThreadGroup使用介紹+自定義線程工廠類實現ThreadFactory接口
VMware installation 64 bit XP Chinese tutorial
Arrays类的使用案例
VMware Workstation 无法连接到虚拟机。系统找不到指定的文件
星界边境Starbound创意工坊订阅的mod的存放路径