-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
39 lines (32 loc) · 1.25 KB
/
script.js
File metadata and controls
39 lines (32 loc) · 1.25 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
const hamburger = document.querySelector(".hamburger");
const navMenu = document.querySelector("nav ul");
hamburger.addEventListener("click", () => {
hamburger.classList.toggle("active");
navMenu.classList.toggle("active");
});
document.querySelectorAll("nav ul li a").forEach(link => {
link.addEventListener("click", () => {
hamburger.classList.remove("active");
navMenu.classList.remove("active");
});
});
const reveals = document.querySelectorAll('.reveal');
function revealOnScroll() {
const windowHeight = window.innerHeight;
reveals.forEach(el => {
const elementTop = el.getBoundingClientRect().top;
if (elementTop < windowHeight - 50) {
el.classList.add('active');
} else {
el.classList.remove('active');
}
});
}
window.addEventListener('scroll', revealOnScroll);
revealOnScroll();
const typed = new Typed('#element', {
strings: ['Web Developer,', 'UI/UX Designer,', 'video editor,', 'Microsoft Professional,', 'AI Learner',],
typeSpeed: 50,
});
document.getElementById('darkBtn').onclick = () => document.body.classList.remove("light");
document.getElementById('lightBtn').onclick = () => document.body.classList.add("light");