-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
61 lines (51 loc) · 1.74 KB
/
script.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var options = {
strings: ["Web Developer", "Programmer", "Cybersecurity Enthusiast", "Java Developer", "Open Source Contributor", "Learner", "Tech Enthusiast"],
typeSpeed: 50,
backSpeed: 25,
loop: true
};
var typed = new Typed("#typed", options);
function isElementInViewport(el) {
const rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
);
}
document.querySelector(".hamburger").addEventListener("click", () => {
document.querySelector(".nav-links").classList.toggle("active");
});
function animateProgressBars() {
const skillsSection = document.getElementById('skills');
const progressBars = document.querySelectorAll('.progress');
if (isElementInViewport(skillsSection)) {
progressBars.forEach(bar => {
const width = bar.style.width;
bar.style.width = '0'; // Reset to 0 for animation
setTimeout(() => {
bar.style.width = width; // Animate to original width
}, 50);
});
}
}
window.addEventListener('scroll', animateProgressBars);
var swiper = new Swiper('.swiper-container', {
effect: 'coverflow',
grabCursor: true,
centeredSlides: true,
slidesPerView: 'auto',
coverflowEffect: {
rotate: -10,
stretch: 0,
depth: 80,
modifier: 15,
slideShadows: true,
},
pagination: {
el: '.swiper-pagination',
},
spaceBetween: 20, // Add space between cards
loop: true, // Enable looping if needed
});