-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.js
41 lines (37 loc) · 1.25 KB
/
about.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
// Typing animation
document.addEventListener('DOMContentLoaded', function() {
new Typed('#typed-text', {
strings: ["Welcome!", "Hi, I'm Linda Achieng", "Front-end Web Developer"],
typeSpeed: 50,
backSpeed: 25,
loop: true
});
});
// Scroll reveal animations
document.addEventListener('DOMContentLoaded', function() {
const reveals = document.querySelectorAll('.reveal');
function revealElements() {
reveals.forEach(element => {
const windowHeight = window.innerHeight;
const elementTop = element.getBoundingClientRect().top;
const elementVisible = 150;
if (elementTop < windowHeight - elementVisible) {
element.classList.add('visible');
// For skill bars
const skillProgress = element.querySelector('.skill-progress');
if (skillProgress) {
skillProgress.style.width = element.getAttribute('data-skill');
}
} else {
element.classList.remove('visible');
// For skill bars
const skillProgress = element.querySelector('.skill-progress');
if (skillProgress) {
skillProgress.style.width = '0';
}
}
});
}
window.addEventListener('scroll', revealElements);
revealElements(); // Run it once on page load
});