-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
58 lines (50 loc) · 1.67 KB
/
Copy pathscript.js
File metadata and controls
58 lines (50 loc) · 1.67 KB
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
let currentFrame;
window.onload = function () {
let content = document.querySelector('.contentBox');
content.style.opacity = '1';
setTimeout(function () {
let black = document.querySelector('#onLoad');
black.style.opacity = '0';
}, 700);
};
textBoxButton1.addEventListener('click', function () {
transformDataBlock();
toggleHidden('.hiddenContent.one.hidden');
});
textBoxButton2.addEventListener('click', function () {
transformDataBlock();
toggleHidden('.hiddenContent.two.hidden');
});
textBoxButton3.addEventListener('click', function () {
transformDataBlock();
toggleHidden('.hiddenContent.three.hidden');
});
textBoxButton4.addEventListener('click', function () {
transformDataBlock();
toggleHidden('.hiddenContent.four.hidden');
});
function buttonOffHandler(e) {
if(e.path.indexOf(currentFrame) == -1) {
document.removeEventListener('click', buttonOffHandler);
currentFrame.style.animation='';
setTimeout(function () {currentFrame.style.animationName='disappear1';},10);
setTimeout(function () {
currentFrame.classList.toggle('hidden');
transformDataBlock();
currentFrame.style.animationName = 'appear1';
currentFrame = null;
}, 500)
}
}
function transformDataBlock() {
let element = document.querySelector('.contentBox');
element.classList.toggle('hiddenMode');
}
function toggleHidden(hidden) {
let element = document.querySelector(hidden);
element.classList.toggle('hidden');
currentFrame = element;
setTimeout(function () {
document.addEventListener('click', buttonOffHandler);
}, 200);
}