-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
78 lines (67 loc) · 2.37 KB
/
Copy pathscript.js
File metadata and controls
78 lines (67 loc) · 2.37 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const themeToggle = document.getElementById('theme-toggle');
const body = document.body;
const chatButton = document.querySelector('.chat-btn');
themeToggle.addEventListener('change', () => {
if (themeToggle.checked) {
body.classList.remove('dark-mode');
body.classList.add('light-mode');
localStorage.setItem('theme', 'light');
} else {
body.classList.remove('light-mode');
body.classList.add('dark-mode');
localStorage.setItem('theme', 'dark');
}
});
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'light') {
body.classList.remove('dark-mode');
body.classList.add('light-mode');
themeToggle.checked = true;
}
const cards = document.querySelectorAll('.card');
const scrollObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = 1;
entry.target.style.transform = 'translateY(0)';
}
});
}, {
threshold: 0.1
});
cards.forEach(card => {
card.style.opacity = 0;
card.style.transform = 'translateY(20px)';
card.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
scrollObserver.observe(card);
});
chatButton.addEventListener('click', () => {
window.location.href = 'mailto:castro.reyarby@gmail.com';
});
const projects = document.querySelectorAll('.project');
projects.forEach(project => {
project.addEventListener('mouseenter', () => {
project.style.transform = 'translateY(-5px)';
project.style.boxShadow = '0 8px 16px rgba(0, 0, 0, 0.1)';
});
project.addEventListener('mouseleave', () => {
project.style.transform = 'translateY(0)';
project.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.1)';
});
});
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
});