-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
43 lines (38 loc) · 1.66 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
'use strict';
const toggleButton = document.querySelector('.toggle-button');
const navbarLinks = document.querySelector('.navbar-links');
const navLogo = document.getElementById('nav-logo');
const headerLink = document.getElementById('header--link');
const section1Link = document.getElementById('section--1--link');
const section2Link = document.getElementById('section--2--link');
const section3Link = document.getElementById('section--3--link');
const section4Link = document.getElementById('section--4--link');
const section5Link = document.getElementById('section--5--link');
const header = document.querySelector('.header');
const section1 = document.getElementById('section--1');
const section2 = document.getElementById('section--2');
const section3 = document.getElementById('section--3');
const section4 = document.getElementById('section--4');
const section5 = document.getElementById('section--5');
//scroll events
headerLink.addEventListener('click', function (e) {
header.scrollIntoView({ behavior: 'smooth' });
});
section1Link.addEventListener('click', function (e) {
section1.scrollIntoView({ behavior: 'smooth' });
});
section2Link.addEventListener('click', function (e) {
section2.scrollIntoView({ behavior: 'smooth' });
});
// section3Link.addEventListener('click', function (e) {
// section3.scrollIntoView({ behavior: 'smooth' });
// });
// section4Link.addEventListener('click', function (e) {
// section4.scrollIntoView({ behavior: 'smooth' });
// });
// section5Link.addEventListener('click', function (e) {
// section5.scrollIntoView({ behavior: 'smooth' });
// });
toggleButton.addEventListener('click', () => {
navbarLinks.classList.toggle('active');
});