糊糊
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yiqiu
2025-11-22 00:37:09 +08:00
parent b5cda581eb
commit 611a10b872
5 changed files with 55 additions and 6 deletions

View File

@@ -41,6 +41,26 @@ $(function () {
}
const idx = index >= 0 && index < bannerData.length ? index : 0;
const item = bannerData[idx] || {};
// 标签渲染:标题上方的小块标签
const $tagsWrap = $("#bannerTags");
if ($tagsWrap.length) {
$tagsWrap.empty();
const rawTags = item.tags || "";
const tags = rawTags
.split(/[,]/)
.map((t) => t.trim())
.filter((t) => t);
tags.forEach((tag) => {
$tagsWrap.append(
`<span class="banner-tag-pill">${tag}</span>`
);
});
if (tags.length === 0) {
$tagsWrap.hide();
} else {
$tagsWrap.show();
}
}
$("#bannerTitle").text(item.title || "");
$("#bannerDesc").text(item.description || "");
const $btn = $("#bannerButton");
@@ -76,6 +96,12 @@ $(function () {
}
bannerTextTimer = setInterval(() => {
current = (current + 1) % bannerData.length;
// 淡入动画:先让文案透明,再渐显
const $copy = $(".banner-copy");
$copy
.stop(true, true)
.css({ opacity: 0 })
.animate({ opacity: 1 }, 400);
updateBannerText(current);
}, 5000);
};