summaryrefslogtreecommitdiffstats
path: root/assets/js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-11 11:32:35 +0200
committerDanilo M. <danix@danix.xyz>2026-05-11 11:32:51 +0200
commitc5078a2adf338703d7b7a3d62e6594fe2831bc5d (patch)
treeb5e7e4e51c2fdca0d298fa9323a0bae9135c7956 /assets/js
parent563e87afd4ce4ef48acef4f29927579ca69d01cb (diff)
downloaddanixxyz-theme-c5078a2adf338703d7b7a3d62e6594fe2831bc5d.tar.gz
danixxyz-theme-c5078a2adf338703d7b7a3d62e6594fe2831bc5d.zip
feat: hero name glitch effect on homepage
Chromatic aberration glitch on h1.hero-name. Gravatar moved from markdown shortcode to template. JS fires randomly every 4-11s. Respects prefers-reduced-motion. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/hero-glitch.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/assets/js/hero-glitch.js b/assets/js/hero-glitch.js
new file mode 100644
index 0000000..1b39b2f
--- /dev/null
+++ b/assets/js/hero-glitch.js
@@ -0,0 +1,12 @@
+(function () {
+ var name = document.querySelector('.hero-name');
+ if (!name) return;
+ if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
+
+ function glitch() {
+ name.classList.add('is-glitching');
+ setTimeout(function () { name.classList.remove('is-glitching'); }, 500);
+ setTimeout(glitch, 4000 + Math.random() * 7000);
+ }
+ setTimeout(glitch, 3500);
+})();