forked from kd1729/portfolio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
91 lines (80 loc) · 2.73 KB
/
app.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
// animation for hero section
let tl = gsap.timeline({defaults: {duration: 2}});
// animation for about me
let tl2 = gsap.timeline({
scrollTrigger: {
trigger: ".intro"
}
});
// animation for skills section
let tl3 = gsap.timeline({
scrollTrigger: {
trigger: ".skills"
}
});
// animation for projects section
let tl4 = gsap.timeline({
scrollTrigger: {
trigger: ".projects",
start: "top center"
}
});
// animation for contact me section
let tl5 = gsap.timeline({
scrollTrigger: {
trigger: ".contact"
}
});
// animation for strengths section
let tl6 = gsap.timeline({
scrollTrigger: {
trigger: ".strengths"
}
});
tl.from(".fade", {opacity: 0, delay: .7, stagger: .3});
tl2.from(".stagger", {opacity: 0, stagger: .3, duration: 2, y: 40, delay: .5});
tl3.from(".skill-card", {opacity: 0, stagger: .3, duration: 2, y: 40, delay: .5});
tl4.from(".grid-item", {opacity: 0, stagger: .3, duration: 2, y: 40, delay: .5});
tl5.from(".scroll", {opacity: 0, stagger: .3, duration: 2, y: 40, delay: .5});
tl6.from(".strength-card", {opacity: 0, stagger: .3, duration: 2, y: 40, delay: .5});
const handlesubmit = () => {
if (confirm("Message Send Successfully")) {
window.location.href = "https://onlykingkd.github.io/portfolio/";
return false;
}
}
//animation for navbar
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
let nodes = document.getElementById('logo').getElementsByTagName('a');
let linknodes = document.getElementById('links').getElementsByTagName('a');
if (document.body.scrollTop > 90 || document.documentElement.scrollTop > 90 ) {
document.getElementById("navbar").style.padding = "0px 0px";
nodes[0].style.fontSize = "2rem";
for(var i=0; i<nodes.length; i++) {
linknodes[i].style.fontSize = "1.2rem";
}
} else {
document.getElementById("navbar").style.padding = "30px 30px";
nodes[0].style.fontSize = "2.5rem";
for(var i=0; i<nodes.length; i++) {
linknodes[i].style.fontSize = "1.5rem";
}
}
}
//Get the button:
mybutton = document.getElementById("myBtn");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function () { scrollFunction() };
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}