From c2db993f5cbf767e06eecd1216650357b1ad4d1b Mon Sep 17 00:00:00 2001 From: "phattaranun.a" Date: Sat, 22 Aug 2026 19:40:24 +0700 Subject: [PATCH] Add marquee functionality to sponsor section with animation --- ui/index.html | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/ui/index.html b/ui/index.html index 84a8365..576acf1 100644 --- a/ui/index.html +++ b/ui/index.html @@ -220,17 +220,30 @@ .mu-sponsor-head { text-align: center; margin-bottom: 18px; } .mu-sponsor-head h4 { margin: 0 0 4px; font-size: 1rem; font-weight: 800; color: #1f2a44; letter-spacing: .01em; } .mu-sponsor-head .lead { margin: 0; color: #6f7b95; font-size: .84rem; } + .mu-marquee { + overflow: hidden; + position: relative; + } .mu-marquee-track { display: flex; - flex-wrap: wrap; - justify-content: center; - gap: 16px; + width: max-content; padding: 4px 0 16px; + animation: mu-marquee-scroll 28s linear infinite; + } + .mu-marquee:hover .mu-marquee-track { animation-play-state: paused; } + @keyframes mu-marquee-scroll { + from { transform: translateX(0); } + to { transform: translateX(-50%); } + } + @media (prefers-reduced-motion: reduce) { + .mu-marquee-track { animation: none; width: auto; flex-wrap: wrap; justify-content: center; gap: 16px; } + .mu-marquee-tile { margin-right: 0; } } .mu-marquee-tile { flex: 0 0 auto; width: 170px; height: 96px; + margin-right: 16px; display: flex; align-items: center; justify-content: center; @@ -431,6 +444,16 @@ document.head.appendChild(s); } + function initMarquee() { + var track = document.querySelector('.mu-marquee-track'); + if (!track || track.dataset.cloned) return; + var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if (!reduce) { + track.innerHTML += track.innerHTML; + track.dataset.cloned = '1'; + } + } + function loadHome() { return fetch('partials/home.html') .then(function (res) { @@ -440,6 +463,7 @@ .then(function (html) { view.innerHTML = html; initHomeSelectors(); + initMarquee(); window.scrollTo(0, 0); }) .catch(function () {