-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
158 lines (137 loc) · 5.07 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
const logoChange = () =>{
const logoImages = [
"./assets/triangle.png",
"./assets/eclipse.png",
"./assets/square.png"
];
const logo = document.querySelector('#logo img');
const logoName = document.querySelector('#logo h1');
let counter = 0;
logo.src = logoImages[counter];
interval = setInterval(() => {
if(counter >= logoImages.length-1){
logo.src = logoImages[logoImages.length-1];
logoName.classList.add('show-logo-name');
counter++;
if(counter >= 6){
logoName.classList.remove('show-logo-name');
}
}
else{
counter++;
logo.src = logoImages[counter];
}
}, 500);
}
const imagesForContainer = () =>{
const images = [
"./assets/first.jpg",
"./assets/second.jpg",
"./assets/third.jpg",
"./assets/fourth.jpg",
"./assets/fifth.jpg",
"./assets/sixth.jpg",
"./assets/seventh.jpg",
"./assets/eigtht.jpg",
"./assets/ninth.jpg",
"./assets/tenth.jpg",
];
const imagesContainer = document.querySelector('.images-container');
let counter = 0;
interval = setInterval(() => {
if(counter === images.length-1){
counter = 0;
}
imagesContainer.style.background = `url("${images[counter]}") no-repeat center`;
imagesContainer.style.backgroundSize = 'cover';
counter++;
}, 750);
}
const workTagHover = () =>{
const workTag = document.getElementById('work-tag');
const footerTag = document.getElementById('footer-tag');
const blurred = document.querySelector('#blurred');
const logo = document.getElementById('logo');
const rightSideFooter = document.querySelector('.right-side');
const footerBottom = document.querySelector('.footer-bottom');
const footerBottomText = document.querySelector('.footer-bottom-text');
workTag.addEventListener('mouseover', () =>{
blurred.style.filter = 'blur(5px)';
logo.style.filter = 'blur(5px)';
})
workTag.addEventListener('mouseout', () =>{
blurred.style.filter = 'blur(0px)';
logo.style.filter = 'blur(0px)';
})
footerTag.addEventListener('mouseover', () =>{
blurred.style.filter = 'blur(5px)';
logo.style.filter = 'blur(5px)';
footerBottom.style.filter = 'blur(5px)';
rightSideFooter.style.filter = 'blur(5px)';
footerBottomText.style.filter = 'blur(5px)';
})
footerTag.addEventListener('mouseout', () =>{
blurred.style.filter = 'blur(0px)';
logo.style.filter = 'blur(0px)';
footerBottom.style.filter = 'blur(0px)';
rightSideFooter.style.filter = 'blur(0px)';
footerBottomText.style.filter = 'blur(0px)';
})
footerBottom.addEventListener('mouseover', () =>{
if(window.matchMedia('(max-width:768px)').matches){
footerBottomText.style.transform = 'translateY(0px)';
} else{
footerBottomText.style.transform = 'translateY(-20px)';
}
})
footerBottom.addEventListener('mouseout', () =>{
footerBottomText.style.transform = 'translateY(0px)';
})
}
const textShadow = () => {
const text = document.getElementById('footer-tag');
const textP = document.querySelector('#footer-tag p')
const textSpan = document.querySelector('#footer-tag span')
const walk = 100;
function shadow(e) {
const {offsetWidth: width, offsetWidth: height } = text;
let {offsetX: x, offsetY: y} = e;
if(this !== e.target){
x = x + e.target.offsetLeft;
y = y + e.target.offsetTop;
}
const xWalk = Math.round(( x / width * walk) - (walk / 2));
const yWalk = Math.round(( y / width * walk) - (walk / 2));
textP.style.textShadow = `${xWalk}px ${yWalk}px 5px rgba(255,255,255, .1)`;
textSpan.style.textShadow = `${xWalk}px ${yWalk}px 5px rgba(227,30,60, .1)`;
}
text.addEventListener('mousemove', shadow);
text.addEventListener('mouseout', () =>{
textP.style.textShadow = 'none';
textSpan.style.textShadow = 'none';
})
}
const nugsFunction = () => {
const nugsButton = document.querySelector('.first-row button');
const nugsContainer = document.querySelector('.nugs-container');
const nugsNevermindButton = document.querySelector('#nugs-container .nugs-bottom-container button');
const appearContainer = document.querySelector('#appear-on-nugs-show');
nugsButton.addEventListener('click', () =>{
nugsContainer.classList.add('show-nugs');
appearContainer.classList.add('appear-now');
nugsNevermindButton.addEventListener('click', () =>{
nugsContainer.classList.remove('show-nugs')
})
document.querySelector('body').addEventListener('click', e =>{
console.log(e.target)
if(e.target.id === 'appear-on-nugs-show' || e.target.className === 'fade-in'){
nugsContainer.classList.remove('show-nugs');
}
})
})
}
nugsFunction();
textShadow();
imagesForContainer();
logoChange();
workTagHover();