-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
94 lines (83 loc) · 2.95 KB
/
javascript.js
File metadata and controls
94 lines (83 loc) · 2.95 KB
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
// Kleine animatie op nav-items bij binnenkomst
document.querySelectorAll('nav a').forEach((link, index) => {
link.style.opacity = 0;
setTimeout(() => {
link.style.transition = 'opacity 1s ease';
link.style.opacity = 1;
}, 500 + index * 200);
});
// Fade-in bij scroll
const faders = document.querySelectorAll('.fade-in');
const appearOnScroll = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if(entry.isIntersecting){
entry.target.classList.add('visible');
observer.unobserve(entry.target);
}
});
}, {
threshold: 0.2
});
faders.forEach(fader => {
appearOnScroll.observe(fader);
});
const text = "Coming soon... Programmeerpagina in aanbouw!";
let i = 0;
const typing = document.getElementById("typing");
function type() {
if (i < text.length) {
typing.innerHTML += text.charAt(i);
i++;
setTimeout(type, 80);
}
}
const dot = document.querySelector('.cursor-dot');
const bg = document.querySelector('.parallax-bg');
const btn = document.querySelector('.magnetic-btn');
document.addEventListener('mousemove', (e) => {
dot.style.transform = `translate(${e.clientX - 6}px, ${e.clientY - 6}px)`;
const x = (e.clientX / window.innerWidth - 0.5) * 30;
const y = (e.clientY / window.innerHeight - 0.5) * 30;
bg.style.transform = `translate(${x}px, ${y}px)`;
});
// Magnetic button effect
btn.addEventListener('mousemove', (e) => {
const rect = btn.getBoundingClientRect();
const offsetX = e.clientX - rect.left - rect.width / 2;
const offsetY = e.clientY - rect.top - rect.height / 2;
btn.style.transform = `translate(${offsetX * 0.2}px, ${offsetY * 0.2}px)`;
});
btn.addEventListener('mouseleave', () => {
btn.style.transform = 'translate(0, 0)';
});
const track = document.querySelector('.slider-track');
track.addEventListener('mouseover', () => track.style.animationPlayState = 'paused');
track.addEventListener('mouseout', () => track.style.animationPlayState = 'running');
const filterButtons = document.querySelectorAll('.filter-btn');
const projects = document.querySelectorAll('.project-card');
filterButtons.forEach(btn => {
btn.addEventListener('click', () => {
filterButtons.forEach(b => b.classList.remove('active'));
btn.classList.add('active');
const filter = btn.getAttribute('data-filter');
projects.forEach(card => {
const category = card.getAttribute('data-category');
if (filter === 'all' || filter === category) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
});
});
type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement(
{
pageLanguage: 'nl',
includedLanguages: 'en,nl,fr,de,es,it', // Voeg hier andere talen toe
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
},
'google_translate_element'
);
}