forked from kontur-web-courses/positioning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
48 lines (38 loc) · 1.3 KB
/
index.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
38
39
40
41
42
43
44
45
46
47
48
const modal = document.getElementById("modalWindow");
const modalButton = document.getElementById("openModal");
const span = document.getElementsByClassName("closeButton")[0];
modalButton.onclick = function() {
modal.style.display = "block";
}
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target === modal) {
modal.style.display = "none";
}
}
document.addEventListener("DOMContentLoaded", function() {
const progressBar = document.querySelector(".progress");
const loadingText = document.querySelector(".loading-text");
let progress = 0;
progressBar.style.width = progress + "%";
function animateProgress() {
const interval = setInterval(function() {
progress++;
progressBar.style.width = progress + "%";
loadingText.textContent = "Loading... " + progress + "%";
if (progress >= 100) {
clearInterval(interval);
loadingText.textContent = "complete";
}
}, 30);
}
animateProgress();
});
/*
Изменить элементу цвет и ширину можно вот так:
const element = document.querySelector('.myElement');
element.style.color = 'red';
element.style.width = '300px';
*/