-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
53 lines (46 loc) · 1.73 KB
/
script.js
File metadata and controls
53 lines (46 loc) · 1.73 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
document.addEventListener('DOMContentLoaded', function() {
const navLinks = document.querySelectorAll('nav a');
const currentPage = window.location.pathname.split('/').pop() || 'index.html';
navLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === currentPage) {
link.classList.add('active');
}
});
const fruitCards = document.querySelectorAll('.fruit-card');
fruitCards.forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-5px)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0)';
});
});
const missionBox = document.querySelector('.mission-box');
if (missionBox) {
missionBox.addEventListener('click', function() {
this.style.animation = 'pulse 0.5s ease-in-out';
setTimeout(() => {
this.style.animation = '';
}, 500);
});
}
const highlights = document.querySelectorAll('.highlight');
highlights.forEach(highlight => {
highlight.addEventListener('mouseenter', function() {
this.style.fontSize = '1.1em';
this.style.transition = 'font-size 0.2s ease';
});
highlight.addEventListener('mouseleave', function() {
this.style.fontSize = '';
});
});
window.addEventListener('scroll', function() {
const header = document.querySelector('header');
if (window.scrollY > 50) {
header.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
} else {
header.style.boxShadow = '0 2px 5px rgba(0,0,0,0.1)';
}
});
});