-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (22 loc) · 786 Bytes
/
Copy pathscript.js
File metadata and controls
29 lines (22 loc) · 786 Bytes
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
// Update date
function updateDate() {
const now = new Date();
const options = { month: 'short', day: 'numeric', year: 'numeric' };
document.getElementById('update-date').textContent = now.toLocaleDateString('en-US', options);
}
updateDate();
// js for glitch text
function applyGlitchEffect(element) {
element.classList.add('glitch-text');
}
function removeGlitchEffect(element) {
element.classList.remove('glitch-text');
}
const glitchWords = document.querySelectorAll('.glitch-word');
function randomGlitch() {
glitchWords.forEach(removeGlitchEffect);
const target = glitchWords[Math.floor(Math.random() * glitchWords.length)];
applyGlitchEffect(target);
setTimeout(() => removeGlitchEffect(target), 900);
}
setInterval(randomGlitch, 2000);