diff --git a/src/config.ts b/src/config.ts
index 58a3cac..3732232 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -35,7 +35,7 @@ export const siteConfig: SiteConfig = {
},
background: {
enable: true, // Enable background image
- src: "https://t.alcy.cc/acg", // Background image URL (supports HTTPS)
+ src: "https://t.alcy.cc/ycy", // Background image URL (supports HTTPS)
position: "center", // Background position: 'top', 'center', 'bottom'
size: "cover", // Background size: 'cover', 'contain', 'auto'
repeat: "no-repeat", // Background repeat: 'no-repeat', 'repeat', 'repeat-x', 'repeat-y'
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index fc9f949..c456313 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -126,11 +126,11 @@ const bannerOffset =
-
- -->
+
{
/*
@@ -198,27 +198,25 @@ const bannerOffset =
`${offset}px`
);
- // // Background image loading detection
- // const bgUrl = getComputedStyle(document.documentElement).getPropertyValue('--bg-url').trim();
- // const bgEnable = getComputedStyle(document.documentElement).getPropertyValue('--bg-enable').trim();
-
- // if (bgUrl && bgUrl !== 'none' && bgEnable === '1') {
- // const img = new Image();
- // const urlMatch = bgUrl.match(/url\(["']?([^"')]+)["']?\)/);
- // if (urlMatch) {
- // img.onload = function() {
- // // 背景图片完全加载后,显示背景并启用卡片透明效果
- // document.body.classList.add('bg-loaded');
- // document.documentElement.style.setProperty('--card-bg', 'var(--card-bg-transparent)');
- // document.documentElement.style.setProperty('--float-panel-bg', 'var(--float-panel-bg-transparent)');
- // };
- // img.onerror = function() {
- // // Keep cards opaque if background image fails to load
- // console.warn('Background image failed to load, keeping cards opaque');
- // };
- // img.src = urlMatch[1];
- // }
- // }
+ // Background image loading detection
+ const bgUrl = bgConfig.enable && bgConfig.src ? bgConfig.src : '';
+
+ if (bgUrl) {
+ const img = new Image();
+ img.onload = function() {
+ // 背景图片完全加载后,显示背景并启用卡片透明效果
+ document.body.classList.add('bg-loaded');
+ document.getElementById('bg-box').classList.add('loaded');
+ document.documentElement.style.setProperty('--card-bg', 'var(--card-bg-transparent)');
+ document.documentElement.style.setProperty('--float-panel-bg', 'var(--float-panel-bg-transparent)');
+ document.documentElement.style.setProperty('--page-bg', 'transparent');
+ };
+ img.onerror = function() {
+ // Keep cards opaque if background image fails to load
+ console.warn('Background image failed to load, keeping cards opaque');
+ };
+ img.src = bgUrl;
+ }