-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
523 lines (420 loc) · 19.1 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
// Deze onderstaande code berekend de totale width van een div
// met deze width kan de animatie smooth verlopen
const div = document.querySelectorAll('div');
// Bereken de totale breedte van de ul-elementen
let totalWidth = 0;
div.forEach((div) => {
totalWidth = div.offsetWidth;
});
console.log(totalWidth)
// animation pause, door te hoveren over a pauzeert de animatie
const carousels = document.querySelectorAll('.projects-carousel');
carousels.forEach((carousel) => {
const links = carousel.querySelectorAll('a');
links.forEach((link) => {
link.addEventListener('mouseover', () => {
carousels.forEach((carousel) => {
carousel.style.animationPlayState = 'paused';
});
});
link.addEventListener('mouseout', () => {
carousels.forEach((carousel) => {
carousel.style.animationPlayState = 'running';
});
});
});
});
// inner text after hover links
const profileCard = document.querySelectorAll('a:nth-of-type(1), .touchscreen-projects button:nth-of-type(1)')
const verve = document.querySelectorAll('a:nth-of-type(2), .touchscreen-projects button:nth-of-type(2)')
const countries = document.querySelectorAll('a:nth-of-type(3), .touchscreen-projects button:nth-of-type(3)')
const iOdigital = document.querySelectorAll('a:nth-of-type(4), .touchscreen-projects button:nth-of-type(4)')
const cssWeek = document.querySelectorAll('a:nth-of-type(5), .touchscreen-projects button:nth-of-type(5)')
const television = document.querySelectorAll('a:nth-of-type(6), .touchscreen-projects button:nth-of-type(6)')
const chat = document.querySelectorAll('a:nth-of-type(7), .touchscreen-projects button:nth-of-type(7)')
const blog = document.querySelectorAll('a:nth-of-type(8), .touchscreen-projects button:nth-of-type(8)')
const h2 = document.querySelector('.innerHTML')
const p = document.querySelector('.innerHTML-p')
const touchscreenLink = document.querySelector('.touchscreen-link')
const touchscreenLinkVerve = document.querySelector('.touchscreen-link-verve')
const touchscreenLinkCountries = document.querySelector('.touchscreen-link-countries')
const touchscreenLinkiOdigital = document.querySelector('.touchscreen-link-iOdigital')
const touchscreenLinkCSS = document.querySelector('.touchscreen-link-CSS')
const touchscreenLinkTele = document.querySelector('.touchscreen-link-tele')
const touchscreenLinkChat = document.querySelector('.touchscreen-link-chat')
const touchscreenLinkBlog = document.querySelector('.touchscreen-link-blog')
const skillsList = document.querySelector('.skills-list')
// skills
const skillsProfileCard = ["Node.js", "EJS", "Json", "Express", "CSS", "JavaScript"];
const skillsVerve = ["HTML", "CSS", "JavaScript"];
const skillsCountries = ["Express", "REST API", "Json", "Node.js", "EJS", "CSS"];
const skillsiOdigital = ["Node.js", "EJS", "Json", "Express", "CSS", "JavaScript"];
const skillsCssWeek = ["HTML", "CSS", "JavaScript"];
const skillsTelevision = ["HTML", "CSS", "JavaScript"];
const skillsViniMiniChat = ["HTML", "CSS", "JavaScript", "Socket.io", "Node.js", "Express"];
const skillsBlog = ["HTML", "CSS", "JavaScript"];
// Functie om list items te maken voor elk item in de array 'skills'
function createSkillListItems(skills) {
skillsList.innerHTML = ''; // Leeg de bestaande inhoud om te voorkomen dat er duplicaten ontstaan
skills.forEach(skill => {
if (skill !== "") {
const li = document.createElement('li');
li.innerHTML = skill;
skillsList.appendChild(li);
}
});
}
// Connect Your Tribe Profile Card
profileCard.forEach(card => {
card.addEventListener('mouseover', infoProfileCard);
card.addEventListener('click', infoProfileCard);
if (!('ontouchstart' in window) || !navigator.maxTouchPoints) {
card.addEventListener('mouseout', () => {
mouseOut();
})
}})
function infoProfileCard() {
createSkillListItems(skillsProfileCard);
p.innerHTML = 'Neem een kijkje op mijn visitekaart website en leer meer over mij.';
// check touch/niet touch
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// wel touch
h2.classList.add('display-none');
touchscreenLink.classList.add('touchscreen-link-visible')
touchscreenLinkVerve.classList.remove('touchscreen-link-visible')
touchscreenLinkCountries.classList.remove('touchscreen-link-visible')
touchscreenLinkiOdigital.classList.remove('touchscreen-link-visible')
touchscreenLinkCSS.classList.remove('touchscreen-link-visible')
touchscreenLinkTele.classList.remove('touchscreen-link-visible')
touchscreenLinkChat.classList.remove('touchscreen-link-visible')
touchscreenLinkBlog.classList.remove('touchscreen-link-visible')
} else {
// geen touch
h2.innerHTML = 'Connect Your Tribe Profile Card';
}
}
// The Verve Agency Careers Page
verve.forEach( verve => {
verve.addEventListener('mouseover', infoVerve)
verve.addEventListener('click', infoVerve);
if (!('ontouchstart' in window) || !navigator.maxTouchPoints) {
verve.addEventListener('mouseout', () => {
mouseOut();
})
}})
function infoVerve() {
createSkillListItems(skillsVerve);
p.innerHTML = "Voor the Verve Agency heb ik een interactieve pagina gemaakt die potentiële designers (en developers) nieuwsgierig en warm maakt om bij The Verve Agency te solliciteren."
// check touch/niet touch
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// wel touch
h2.classList.add('display-none');
touchscreenLinkVerve.classList.add('touchscreen-link-visible')
touchscreenLink.classList.remove('touchscreen-link-visible')
touchscreenLinkCountries.classList.remove('touchscreen-link-visible')
touchscreenLinkiOdigital.classList.remove('touchscreen-link-visible')
touchscreenLinkCSS.classList.remove('touchscreen-link-visible')
touchscreenLinkTele.classList.remove('touchscreen-link-visible')
touchscreenLinkChat.classList.remove('touchscreen-link-visible')
touchscreenLinkBlog.classList.remove('touchscreen-link-visible')
} else {
// geen touch
h2.innerHTML = "The Verve Agency Careers Page"
}
}
// Countries
countries.forEach(country =>{
country.addEventListener('mouseover', infoCountries)
country.addEventListener('click', infoCountries);
if (!('ontouchstart' in window) || !navigator.maxTouchPoints) {
country.addEventListener('mouseout', () => {
mouseOut();
})
}})
function infoCountries() {
p.innerHTML = "Op deze webpagina kan je informatie vinden over alle landen ter wereld. Dit project heb ik gemaakt om te oefenen met REST API."
createSkillListItems(skillsCountries);
// check touch/niet touch
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// wel touch
h2.classList.add('display-none');
touchscreenLinkCountries.classList.add('touchscreen-link-visible')
touchscreenLink.classList.remove('touchscreen-link-visible')
touchscreenLinkVerve.classList.remove('touchscreen-link-visible')
touchscreenLinkiOdigital.classList.remove('touchscreen-link-visible')
touchscreenLinkCSS.classList.remove('touchscreen-link-visible')
touchscreenLinkTele.classList.remove('touchscreen-link-visible')
touchscreenLinkChat.classList.remove('touchscreen-link-visible')
touchscreenLinkBlog.classList.remove('touchscreen-link-visible')
} else {
// geen touch
h2.innerHTML = "Countries"
}
}
// iOdigital Online CV Presentation Tool
iOdigital.forEach(iO => {
iO.addEventListener('mouseover', infoiO)
iO.addEventListener('click', infoiO);
if (!('ontouchstart' in window) || !navigator.maxTouchPoints) {
iO.addEventListener('mouseout', () => {
mouseOut();
})
}})
function infoiO() {
p.innerHTML = "Met deze online CV presentatie tool wordt het voortaan veel makkelijker om een CV op te sturen naar een hiring manager. Er is geen PDF meer nodig."
createSkillListItems(skillsiOdigital);
// check touch/niet touch
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// wel touch
h2.classList.add('display-none');
touchscreenLinkiOdigital.classList.add('touchscreen-link-visible')
touchscreenLinkCountries.classList.remove('touchscreen-link-visible')
touchscreenLink.classList.remove('touchscreen-link-visible')
touchscreenLinkVerve.classList.remove('touchscreen-link-visible')
touchscreenLinkCSS.classList.remove('touchscreen-link-visible')
touchscreenLinkTele.classList.remove('touchscreen-link-visible')
touchscreenLinkChat.classList.remove('touchscreen-link-visible')
touchscreenLinkBlog.classList.remove('touchscreen-link-visible')
} else {
// geen touch
h2.innerHTML = "iOdigital Online CV Presentation Tool"
}
}
// CSS week project
cssWeek.forEach(css => {
css.addEventListener('mouseover', infoCSS)
css.addEventListener('click', infoCSS)
if (!('ontouchstart' in window) || !navigator.maxTouchPoints) {
css.addEventListener('mouseout', () => {
mouseOut();
})
}})
function infoCSS() {
p.innerHTML = "Tijdens de voorjaarsvakantie heb ik meegedaan met de CSS week van Sanne 't hooft. Hier heb ik supercoole nieuwe dingen geleerd en met CSS geoefend!"
createSkillListItems(skillsCssWeek);
// check touch/niet touch
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// wel touch
h2.classList.add('display-none');
touchscreenLinkCSS.classList.add('touchscreen-link-visible')
touchscreenLinkCountries.classList.remove('touchscreen-link-visible')
touchscreenLink.classList.remove('touchscreen-link-visible')
touchscreenLinkVerve.classList.remove('touchscreen-link-visible')
touchscreenLinkiOdigital.classList.remove('touchscreen-link-visible')
touchscreenLinkTele.classList.remove('touchscreen-link-visible')
touchscreenLinkChat.classList.remove('touchscreen-link-visible')
touchscreenLinkBlog.classList.remove('touchscreen-link-visible')
} else {
// geen touch
h2.innerHTML = "CSS week project"
}
}
// Bekijk mijn nieuwe TV!
television.forEach(television => {
television.addEventListener('mouseover', infoTele)
television.addEventListener('click', infoTele)
if (!('ontouchstart' in window) || !navigator.maxTouchPoints) {
television.addEventListener('mouseout', () => {
mouseOut();
})
}})
function infoTele() {
p.innerHTML = "Door de CSS week was ik zo geïnspireert geraakt dus heb ik een tv heb gemaakt."
createSkillListItems(skillsTelevision);
// check touch/niet touch
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// wel touch
h2.classList.add('display-none');
touchscreenLinkTele.classList.add('touchscreen-link-visible')
touchscreenLinkCountries.classList.remove('touchscreen-link-visible')
touchscreenLink.classList.remove('touchscreen-link-visible')
touchscreenLinkVerve.classList.remove('touchscreen-link-visible')
touchscreenLinkiOdigital.classList.remove('touchscreen-link-visible')
touchscreenLinkCSS.classList.remove('touchscreen-link-visible')
touchscreenLinkChat.classList.remove('touchscreen-link-visible')
touchscreenLinkBlog.classList.remove('touchscreen-link-visible')
} else {
// geen touch
h2.innerHTML = "Bekijk mijn nieuwe TV!"
}
}
// Vini Mini chatroom
chat.forEach(chat => {
chat.addEventListener('mouseover', infoChat)
chat.addEventListener('click', infoChat)
if (!('ontouchstart' in window) || !navigator.maxTouchPoints) {
chat.addEventListener('mouseout', () => {
mouseOut();
})
}})
function infoChat() {
p.innerHTML = "Voor deze opdracht heb ik voor Vini Mini een chatroom gemaakt met socket.io."
createSkillListItems(skillsViniMiniChat);
// check touch/niet touch
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// wel touch
h2.classList.add('display-none');
touchscreenLinkChat.classList.add('touchscreen-link-visible')
touchscreenLinkCountries.classList.remove('touchscreen-link-visible')
touchscreenLink.classList.remove('touchscreen-link-visible')
touchscreenLinkVerve.classList.remove('touchscreen-link-visible')
touchscreenLinkiOdigital.classList.remove('touchscreen-link-visible')
touchscreenLinkCSS.classList.remove('touchscreen-link-visible')
touchscreenLinkTele.classList.remove('touchscreen-link-visible')
touchscreenLinkBlog.classList.remove('touchscreen-link-visible')
} else {
// geen touch
h2.innerHTML = "Vini Mini chatroom"
}
}
// We Love Web Blog
blog.forEach(blog => {
blog.addEventListener('mouseover', infoBlog)
blog.addEventListener('click', infoBlog)
if (!('ontouchstart' in window) || !navigator.maxTouchPoints) {
blog.addEventListener('mouseout', () => {
mouseOut();
})
}})
function infoBlog() {
p.innerHTML = "Ik heb een blog gemaakt voor het bijhouden van We Love Web presentaties en workshops."
createSkillListItems(skillsBlog);
// check touch/niet touch
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// wel touch
h2.classList.add('display-none');
touchscreenLinkBlog.classList.add('touchscreen-link-visible')
touchscreenLinkCountries.classList.remove('touchscreen-link-visible')
touchscreenLink.classList.remove('touchscreen-link-visible')
touchscreenLinkVerve.classList.remove('touchscreen-link-visible')
touchscreenLinkiOdigital.classList.remove('touchscreen-link-visible')
touchscreenLinkCSS.classList.remove('touchscreen-link-visible')
touchscreenLinkTele.classList.remove('touchscreen-link-visible')
touchscreenLinkChat.classList.remove('touchscreen-link-visible')
} else {
// geen touch
h2.innerHTML = "We Love Web Blog"
}
}
const headerH1 = document.querySelector('header h1')
// ga deze functie waarschijnlijk verwijderen
function detecteerTouchscreen() {
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// touchscreen
p.innerHTML = "Bekijk hier al mijn beste projecten van mijn eerste leerjaar bij de opleiding Frontend Design & Development. Klik op een project hieronder om erover te kunnen lezen. Druk daarna op de link om de website te bezoeken."
headerH1.addEventListener('click', () => {
p.innerHTML = "Bekijk hier al mijn beste projecten van mijn eerste leerjaar bij de opleiding Frontend Design & Development. Klik op een project hieronder om erover te kunnen lezen. Druk daarna op de link om de website te bezoeken."
h2.innerHTML = "Frontend is te gek! 🪐🛰️🛸"
skillsList.innerHTML = ''; // Leeg de lijst bij mouseout
h2.classList.remove('display-none');
touchscreenLinkBlog.classList.remove('touchscreen-link-visible')
touchscreenLinkCountries.classList.remove('touchscreen-link-visible')
touchscreenLink.classList.remove('touchscreen-link-visible')
touchscreenLinkVerve.classList.remove('touchscreen-link-visible')
touchscreenLinkiOdigital.classList.remove('touchscreen-link-visible')
touchscreenLinkCSS.classList.remove('touchscreen-link-visible')
touchscreenLinkTele.classList.remove('touchscreen-link-visible')
touchscreenLinkChat.classList.remove('touchscreen-link-visible')
})
} else {
// geen touchscreen
p.innerHTML = "Bekijk hier al mijn beste projecten van mijn eerste leerjaar bij de opleiding Frontend Design & Development. Ga met de cursor over de projecten hieronder om erover te kunnen lezen. Druk erop om de website te bezoeken."
}
}
detecteerTouchscreen();
function mouseOut(){
h2.innerHTML = "Frontend is te gek! 🪐🛰️🛸"
skillsList.innerHTML = ''; // Leeg de lijst bij mouseout
h2.classList.remove('display-none');
// controleer of touchscreen aanwezig is met de volgende code
// had hulp van chatGPT
if ('ontouchstart' in window || navigator.maxTouchPoints) {
// Touchscreen aanwezig
p.innerHTML = "Bekijk hier al mijn beste projecten van mijn eerste leerjaar bij de opleiding Frontend Design & Development. Klik op een project hieronder om erover te kunnen lezen. Druk daarna op de link om de website te bezoeken."
} else {
// Geen touchscreen aanwezig
p.innerHTML = "Bekijk hier al mijn beste projecten van mijn eerste leerjaar bij de opleiding Frontend Design & Development. Ga met de cursor over de projecten hieronder om erover te kunnen lezen. Druk erop om de website te bezoeken."
}
}
// scrollen met muis over carousel
const completeCarousel = document.querySelector('.complete-carousel');
completeCarousel.addEventListener('mouseenter', () => {
completeCarousel.addEventListener('wheel', handleScroll);
});
completeCarousel.addEventListener('mouseleave', () => {
completeCarousel.removeEventListener('wheel', handleScroll);
});
function handleScroll(event) {
event.preventDefault();
const delta = Math.max(-1, Math.min(1, (event.deltaY || -event.wheelDelta || event.detail)));
completeCarousel.scrollLeft -= delta * 40; // Verstel de scrollsnelheid hier naar wens
}
// the verve dog eyes (geïnspireerd door: https://codepen.io/natan-sitanggang/pen/YzpZXKR?editors=1010)
document.querySelector('body').addEventListener('mousemove', eyeball);
function eyeball(){
var eye = document.querySelectorAll('.eye');
eye.forEach(eye =>{
let x = (eye.getBoundingClientRect().left) + (eye.clientWidth / 2);
let y = (eye.getBoundingClientRect().top) + (eye.clientHeight / 2);
let radian = Math.atan2(event.pageX - x, event.pageY - y);
let rot = (radian * (180 / Math.PI) * -1) - 270;
eye.style.transform = "rotate("+ rot +"deg)";
})
// console.log('hoi' + eye.clientWidth / 2)
}
// space mode (hulp gehad van chatGPT)
const spaceMode = document.querySelector('.space-mode')
let h4 = document.querySelector('h4')
// Bijhouden van de huidige modus
let isSpaceMode = false;
// Functie om de knopinhoud te updaten op basis van de huidige modus
function updateButtonContent() {
if (isSpaceMode) {
spaceMode.innerHTML = '<span class="button-text-mobile">Pastel Mode</span> 🟣';
h4.innerHTML = 'Pastel Mode'
} else {
spaceMode.innerHTML = '<span class="button-text-mobile">Space Mode</span> 🌌';
h4.innerHTML = 'Space Mode'
}
}
// Click event listener voor de knop
spaceMode.addEventListener('click', toggleVariables);
// Functie om de modus om te schakelen en knopinhoud bij te werken
function toggleVariables() {
const root = document.documentElement;
isSpaceMode = root.classList.toggle('space-mode');
updateButtonContent();
}
// Zorg ervoor dat de initiële knopinhoud correct wordt ingesteld
updateButtonContent();
// rocket lauch
const rocketLaunch = document.querySelector('.rocket-launch')
const rocket = document.querySelector('.rocket-container')
rocketLaunch.addEventListener('click', rocketLaunchGo)
function rocketLaunchGo() {
rocket.classList.add('rocket-launch');
rocket.addEventListener("animationend", () => {
rocket.classList.remove('rocket-launch');
});
}
// space walk (hulp van chatgpt)
const spaceWalk = document.querySelector('.space-walk')
const astronaut = document.querySelector('.astronaut')
spaceWalk.addEventListener('click', startAstronautAnimation)
function startAstronautAnimation() {
gsap.from(".astronaut", { scale: 0, visibility: "visible" });
gsap.to(".astronaut", {
scale: 1,
duration: 6,
y: "10rem",
x: "20rem",
yoyo: true,
repeat: 1,
ease: "power1.inOut",
rotate: "360deg",
visibility: "visible",
onComplete: function () {
gsap.to(".astronaut", { scale: 0, rotate: "90deg" });
}
});
}