-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
99 lines (72 loc) · 3.24 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
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
// global variables:
const intro = document.querySelector('.intro');
const introTitle = document.querySelector('.intro--title');
const introImg = document.querySelector('.intro--img');
const introSub = document.querySelector('.intro--subtitle');
const navToggle = document.querySelector('.nav--toggle');
const aboutTitle = document.querySelector('.about-me--title');
const aboutSub = document.querySelector('.about-me--subtitle');
const aboutBody = document.querySelector('.about-me--body');
const aboutImg = document.querySelector('.about-me--img');
const resume = document.querySelector('.resume');
const resumeTitle = document.querySelector('.resume--title');
// hamburger menu => shows the navigation menu, once the button is pressed
navToggle.addEventListener('click', (event) => {
document.body.classList.toggle('nav--open');
});
// navigtion menu => closes the navigation menu, and transports to the relevant section
const navLinks = document.querySelectorAll('.nav--link');
navLinks.forEach(link => {
link.addEventListener('click', () => {
document.body.classList.remove('nav--open');
});
});
// animate in => intro section:
intro.addEventListener('mouseenter', (event) => {
if (window.innerWidth >= 800) {
introImg.style.transition = 'all 0.2s ease';
introImg.style.transform = "translateZ(60px) translateX(-10px)";
introTitle.style.transition = 'all 0.4s ease';
introTitle.style.transform = "translateZ(100px) translateX(20px)";
introSub.style.transition = 'all 0.6s ease';
introSub.style.transform = "translateZ(80px) translateX(30px)";
}
})
// animate out => intro section:
intro.addEventListener('mouseleave', (event) => {
if (window.innerWidth >= 800) {
introImg.style.transition = 'all 0.8s ease';
introImg.style.transform = "translateZ(0px)";
introTitle.style.transition = 'all 0.4s ease';
introTitle.style.transform = "translateZ(0px)";
introSub.style.transition = 'all 0.2s ease';
introSub.style.transform = "translateZ(0px)"
}
})
// animate in => about section:
about.addEventListener('mouseenter', (event) => {
if (window.innerWidth >= 800) {
aboutImg.style.transition = 'all 0.5s ease';
aboutImg.style.transform = "translateX(30px) translateZ(20px)";
aboutTitle.style.transition = 'all 0.9s ease';
aboutTitle.style.transform = "translateZ(100px)";
aboutBody.style.transition = 'all 0.2s ease';
aboutBody.style.transform = "translateZ(60px)";
aboutSub.style.transition = 'all 1.3s ease';
aboutSub.style.transform = "translateX(60px)";
}
})
// animate out => about section:
about.addEventListener('mouseleave', (event) => {
if (window.innerWidth >= 800) {
aboutImg.style.transition = 'all 0.8s ease';
aboutImg.style.transform = "translateX(0px)";
aboutTitle.style.transition = 'all 0.7s ease';
aboutTitle.style.transform = "translateX(0px)";
aboutBody.style.transition = 'all 1.0s ease';
aboutBody.style.transform = "translateZ(0px)";
aboutSub.style.transition = 'all 0.5s ease';
aboutSub.style.transform = "translateX(0px)";
}
})
// light/dark mode (a feature to be added):