-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
67 lines (57 loc) · 1.75 KB
/
script.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Hamburger Menu
const menu = document.querySelector('.hamburger')
const menuLinks = document.querySelector('.mobile-navigation')
menu.addEventListener('click', function () {
console.log('click hamburger')
if (menu.classList.contains('open')) {
//if html class shows 'hamburger open' and you click it, run these:
menu.classList.remove('open')
menuLinks.classList.add('close')
menuLinks.classList.add('fade-out')
menuLinks.classList.remove('fade-in')
} else {
//if html class shows 'hamburger' and you click it, run these:
menu.classList.add('open')
menuLinks.classList.remove('close')
menuLinks.classList.add('fade-in')
menuLinks.classList.remove('fade-out')
}
/*
menu.addEventListener('click', function(){
menu.classList.toggle('open'); if it has open, remove. if it doesn't have open, add.
menuLinks.classList.remove('active'); */
})
// Experience section
var divs = ['Div1', 'Div2', 'Div3', 'Div4']
var visibleDivId = null
function divVisibility(divId) {
if (visibleDivId === divId) {
//visibleDivId = null;
} else {
visibleDivId = divId
}
hideNonVisibleDivs()
}
function hideNonVisibleDivs() {
var i, divId, div
for (i = 0; i < divs.length; i++) {
divId = divs[i]
div = document.getElementById(divId)
if (visibleDivId === divId) {
div.style.display = 'block'
} else {
div.style.display = 'none'
}
}
}
// Bottom menu on mobile devices
myID = document.getElementById('myID')
var myScrollFunc = function () {
var y = window.scrollY
if (y >= 100) {
myID.className = 'bottomMenu show'
} else {
myID.className = 'bottomMenu hide'
}
}
window.addEventListener('scroll', myScrollFunc)