-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
38 lines (30 loc) · 907 Bytes
/
app.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
// Show menu
function showMenu() {
const toggle = document.getElementById('toggle');
const navMenu = document.getElementById('nav-menu');
toggle.addEventListener('click', () => {
navMenu.classList.toggle('show-nav');
toggle.classList.toggle('rotate')
})
}
showMenu();
// CHANGE BACKGROUND HEADER
function changeBgHeader() {
const nav = document.getElementById('header')
if (this.scrollY > 200) {
nav.classList.add('scroll-header');
} else {
nav.classList.remove('scroll-header')
}
}
window.addEventListener('scroll', scrollToTop);
// SHOW SCROLL TOP
function scrollToTop() {
const _scrollTop = document.getElementById('scrolltop');
if (this.scrollY > 560) {
_scrollTop.classList.add('show-scroll');
} else {
_scrollTop.classList.remove('show-scroll');
}
}
window.addEventListener('scroll', scrollToTop);