-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
30 lines (26 loc) · 859 Bytes
/
scripts.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
function toggleMenu() {
const menuIcon = document.querySelector('.menu-icon');
const overlay = document.getElementById('overlay');
menuIcon.classList.toggle('change');
overlay.classList.toggle('show');
}
function updateContent() {
$('nav h1').localize();
$('.overlay-menu a').each(function() {
$(this).localize();
});
}
/* scroll animation */
function handleScroll() {
const elements = document.querySelectorAll('section');
const windowHeight = window.innerHeight;
elements.forEach(el => {
const rect = el.getBoundingClientRect();
if (rect.top <= windowHeight * 0.75 && rect.bottom >= 0) {
el.classList.add('fade-in');
} else {
el.classList.remove('fade-in');
}
});
}
window.addEventListener('scroll', handleScroll);