-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
38 lines (31 loc) · 896 Bytes
/
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
// mobile nav
const hamburger = document.getElementById('hamburger');
const navUL = document.getElementById('nav-ul');
hamburger.addEventListener('click', () => {
navUL.classList.toggle('show');
});
const header = document.querySelector('.header')
window.onscroll = function(){
var top = window.scrollY;
if (top >= 10){
header.classList.add('active')
}
else{
header.classList.remove('active')
}
}
window.addEventListener('scroll', reveal);
function reveal(){
var reveals = document.querySelectorAll('.reveal');
for(var i = 0; i < reveals.length; i++){
var windowheight = window.innerHeight;
var revealtop = reveals[i].getBoundingClientRect().top;
var revealpoint = 150;
if(revealtop < windowheight - revealpoint){
reveals[i].classList.add('active');
}
else{
reveals[i].classList.remove('active');
}
}
}