-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
60 lines (51 loc) · 1.74 KB
/
script.js
File metadata and controls
60 lines (51 loc) · 1.74 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
59
60
function showDataLog() {
const iframe = document.getElementById('dataLogIFrame');
const overview = document.getElementById('overview');
const community = document.getElementById('community');
const getInvolved = document.getElementById('getInvolved');
if (window.location.hash === '#dataLog') {
iframe.style.display = 'block';
} else {
iframe.style.display = 'none';
}
if (window.location.hash === '#overview' || window.location.hash === '') {
overview.style.display = 'block';
} else {
overview.style.display = 'none';
}
if (window.location.hash === '#community') {
community.style.display = 'block';
} else {
community.style.display = 'none';
}
if (window.location.hash === '#getInvolved') {
getInvolved.style.display = 'block';
} else {
getInvolved.style.display = 'none';
}
setTimeout(() => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}, 0);
}
showDataLog();
window.addEventListener('hashchange', showDataLog);
document.addEventListener('DOMContentLoaded', () => {
const menuIcon = document.getElementById('menu-icon');
const navBar = document.getElementsByClassName('navbar')[0];
const navLinks = navBar.getElementsByTagName('a');
menuIcon.addEventListener('click', () => {
console.log(navBar.classList);
navBar.classList.toggle('active');
});
Array.from(navLinks).forEach(link => {
link.addEventListener('click', () => {
// Only toggle active navbar if in compact view
if (window.innerWidth <= 1155) {
navBar.classList.remove('active');
}
})
})
})