-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpvloader.js
37 lines (29 loc) · 922 Bytes
/
pvloader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
document.addEventListener('DOMContentLoaded', function() {
// SET YOUR VARIABLES
var pvloader = document.querySelector('#pvloader');
var model1 = document.querySelector('#your-model-1');
var model2 = document.querySelector('#your-model-2');
// HTML5 LOADER
window.onload = function() {
// ADD VALUE TO BAR ONCE A MODEL IS LOADED
model1.addEventListener('model-loaded', function() {
pvloader.value += 50;
});
// ADD VALUE TO BAR ONCE A MODEL IS LOADED
model2.addEventListener('model-loaded', function() {
pvloader.value += 50;
});
// HIDE WHEN PROGRESS TOTAL = 100%
function start() {
loading.style.opacity = '0';
loading.style.display = 'none';
}
// TIMER TO CHECK IF VALUE IS 100% EVERY 1 SECOND
var checkStatus = setInterval(myTimer, 1000);
function myTimer() {
if (pvloader.value >= 100){
clearInterval(checkStatus);
start();
}
}
}