Add marquee functionality to sponsor section with animation
This commit is contained in:
1 parent
413e280e9a
commit
c2db993f5c
1 file changed
+27
-3
+27
-3
@@ -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 () {
|
||||
|
||||
Reference in new issue
Block a user