-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
75 lines (71 loc) · 3.09 KB
/
index.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>block-ui.js (Example)</title>
</head>
<body>
<div id="container">
<h1>block-ui.js (Example)</h1>
<button id="btn">Block Me (for 3 seconds)</button>
<button id="btn2">Block Me (with messages)</button>
<button id="btn3">Block Me (without gif)</button>
<button id="btn4">Block Me (External gif)</button>
</div>
<script defer>
const btn = document.getElementById('btn');
btn.addEventListener('click', () => {
document.vzool_blockui_image = 'images/loader.gif';
document.vzool_blockui_background = '#121111';
console.log(BlockUI("container").show());
setTimeout(() => {
console.log(BlockUI("container").hide());
}, 3000);
});
const btn2 = document.getElementById('btn2');
btn2.addEventListener('click', async () => {
document.vzool_blockui_image = 'images/loader.gif';
document.vzool_blockui_background = '#121111';
console.log(BlockUI("container").show());
console.log(BlockUI("container").message("<h1 style='padding-top: 190px;'>Loading...</h1>"));
await delay(1500);
for(var i = 0; i < 101; i++) {
console.log(BlockUI("container").message(`<h1 style='padding-top: 190px;'>${i}%</h1>`));
await delay(100);
}
await delay(1500);
console.log(BlockUI("container").message("<h1 style='padding-top: 190px;'>Done</h1>"));
await delay(1500);
console.log(BlockUI("container").hide());
});
const btn3 = document.getElementById('btn3');
btn3.addEventListener('click', async () => {
document.vzool_blockui_image = '';
console.log(BlockUI("container").show());
console.log(BlockUI("container").message("<h1>Loading...</h1>"));
await delay(1500);
for(var i = 0; i < 101; i++) {
console.log(BlockUI("container").message(`<h1>${i}%</h1>`));
await delay(100);
}
await delay(1500);
console.log(BlockUI("container").message("<h1>Done</h1>"));
await delay(1500);
console.log(BlockUI("container").hide());
});
const btn4 = document.getElementById('btn4');
btn4.addEventListener('click', () => {
document.vzool_blockui_image = 'https://raw.githubusercontent.com/vzool/block-ui.js/main/images/cool-loading-animated-gif-1.gif';
document.vzool_blockui_background = '#66CEFF';
console.log(BlockUI("container").show());
setTimeout(() => {
console.log(BlockUI("container").hide());
}, 3000);
});
function delay(time) { return new Promise(resolve => setTimeout(resolve, time)); }
</script>
<script src="block-ui.js"></script>
</body>
</html>