mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
News ticker: show each message once per pass
The duplicated content for a seamless loop put two copies on screen when there are only a few messages. Run a single copy from the right edge until it has left on the left instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
bf6008f857
commit
94b290fa06
2 files changed
+5
-3
No files matched your search
+5
-1
@@ -2630,6 +2630,9 @@
|
|||||||
|
|
||||||
.ts-news-scroll {
|
.ts-news-scroll {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
/* Starts just off the right edge and runs until fully off the left one,
|
||||||
|
so every message is on screen exactly once per pass. */
|
||||||
|
padding-left: 100%;
|
||||||
animation: ts-news-scroll linear infinite;
|
animation: ts-news-scroll linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2659,12 +2662,13 @@
|
|||||||
transform: translateX(0);
|
transform: translateX(0);
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
transform: translateX(-50%);
|
transform: translateX(-100%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.ts-news-scroll {
|
.ts-news-scroll {
|
||||||
|
padding-left: 0;
|
||||||
animation: none;
|
animation: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2658,10 +2658,8 @@ function NewsTicker() {
|
|||||||
<div className="ts-news-ticker">
|
<div className="ts-news-ticker">
|
||||||
<span className="ts-news-label">{t("news.label")}</span>
|
<span className="ts-news-label">{t("news.label")}</span>
|
||||||
<div className="ts-news-track">
|
<div className="ts-news-track">
|
||||||
{/* Rendered twice so the -50% scroll loops seamlessly. */}
|
|
||||||
<div className="ts-news-scroll" style={{ animationDuration: `${Math.max(20, items.length * 12)}s` }}>
|
<div className="ts-news-scroll" style={{ animationDuration: `${Math.max(20, items.length * 12)}s` }}>
|
||||||
{entries}
|
{entries}
|
||||||
<span aria-hidden="true">{entries}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
|||||||
Reference in new issue
Block a user