-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathportfolio.js
111 lines (98 loc) · 2.89 KB
/
portfolio.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
const swiper = new Swiper(".swiper", {
loop: true,
autoplay: {
delay: 2000,
disableOnInteraction: false,
},
effect: "creative",
creativeEffect: {
prev: {
shadow: true,
translate: ["-120%", 0, -500],
// rotate: [0, 100, 0],
},
next: {
opacity: 1,
scale: 1.1,
},
},
autoplayDisableOnInteraction: false,
speed: 1000,
fadeEffect: {
crossFade: true,
},
});
window.addEventListener("scroll", function () {
var navbar = document.querySelector("nav");
var navName = document.querySelector("#nav-name");
var spanElement = document.querySelector("span");
var navResume = document.querySelector("#resume-button-1");
if (window.scrollY > 100) {
navbar.classList.add("nav-scroll");
navName.style.color = "white";
spanElement.style.color = "white";
navResume.style.border = "2px solid white";
} else {
navbar.classList.remove("nav-scroll");
navName.style.color = "#b68d40";
spanElement.style.color = "#b68d40";
navResume.style.border = "none";
}
});
function smoothScroll(target, duration) {
var targetElement = document.querySelector(target);
var targetPosition = targetElement.offsetTop;
var startPosition = window.pageYOffset;
var distance = targetPosition - startPosition;
var startTime = null;
function animation(currentTime) {
if (startTime === null) {
startTime = currentTime;
}
var timeElapsed = currentTime - startTime;
var run = ease(timeElapsed, startPosition, distance, duration);
window.scrollTo(0, run);
if (timeElapsed < duration) {
requestAnimationFrame(animation);
}
}
function ease(t, b, c, d) {
t /= d / 2;
if (t < 1) return (c / 2) * t * t + b;
t--;
return (-c / 2) * (t * (t - 2) - 1) + b;
}
requestAnimationFrame(animation);
}
var links = document.querySelectorAll('a[href^="#"]');
links.forEach(function (link) {
link.addEventListener("click", function (event) {
event.preventDefault();
var target = this.getAttribute("href");
var duration = 1000;
smoothScroll(target, duration);
});
});
GitHubCalendar(".calendar", "Smoke221", { responsive: true });
function downloadResume() {
// Display the first modal
document.getElementById("firstModal").style.display = "block";
// Set a timeout for the second modal
setTimeout(() => {
closeModal("firstModal");
document.getElementById("secondModal").style.display = "block";
}, 2000);
// Set a timeout for the resume modal
setTimeout(() => {
closeModal("secondModal");
document.getElementById("resumeModal").style.display = "block";
// Set a timeout to automatically close the resume modal
setTimeout(() => {
closeModal("resumeModal");
}, 3000); // Close after 3 seconds
}, 4000); // Show last modal after 4 seconds
}
function closeModal(modalId) {
document.getElementById(modalId).style.display = "none";
}
//intro swiper