-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
39 lines (32 loc) · 1.29 KB
/
Copy pathscript.js
File metadata and controls
39 lines (32 loc) · 1.29 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
document.querySelector('.over-container').addEventListener('scroll', function () {
const scrollTop = this.scrollTop;
const headerHeight = document.getElementsByTagName('h1')[0].clientHeight;
const totalHeaderHeight = headerHeight + 20;
if (scrollTop > totalHeaderHeight) {
document.querySelector('.navigation').classList.add('fixed-nav');
document.getElementById('desc').style.marginTop = (document.querySelector('.navigation').clientHeight + 80 + 20) + 'px';
} else {
document.querySelector('.navigation').classList.remove('fixed-nav');
document.getElementById('desc').style.marginTop = '80px';
}
});
const overlay = document.getElementById('overlay');
const navList = document.querySelector('.nav-list');
overlay.style.visibility = 'hidden';
overlay.style.opacity = '0';
navList.addEventListener('mouseover', () => {
overlay.style.opacity = '1';
overlay.style.visibility = 'visible';
});
navList.addEventListener('mouseout', () => {
overlay.style.opacity = '0';
overlay.style.visibility = 'hidden';
});
window.onload = () => {
setTimeout(() => {
document.getElementById('loader').classList.add('close-loading');
}, 4000);
setTimeout(() => {
document.getElementById('loader').style.display = 'none';
}, 4800);
}