fix
This commit is contained in:
@@ -148,7 +148,7 @@ import { Icon } from "astro-icon/components";
|
|||||||
// 从JSON文件加载图片数据
|
// 从JSON文件加载图片数据
|
||||||
async function loadImagesData() {
|
async function loadImagesData() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/i/images.json');
|
const response = await fetch('https://blog.meowrain.cn/api/i/images.json');
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Failed to load images data');
|
throw new Error('Failed to load images data');
|
||||||
}
|
}
|
||||||
@@ -307,6 +307,9 @@ import { Icon } from "astro-icon/components";
|
|||||||
grid.classList.remove('opacity-0');
|
grid.classList.remove('opacity-0');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 显示 sentinel
|
||||||
|
if (sentinel) sentinel.classList.remove('hidden');
|
||||||
|
|
||||||
// 设置 Intersection Observer
|
// 设置 Intersection Observer
|
||||||
if (observer) observer.disconnect();
|
if (observer) observer.disconnect();
|
||||||
observer = new IntersectionObserver((entries) => {
|
observer = new IntersectionObserver((entries) => {
|
||||||
@@ -595,8 +598,13 @@ import { Icon } from "astro-icon/components";
|
|||||||
initFilterButtons();
|
initFilterButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化
|
// 初始化 - 等待 DOM 准备好
|
||||||
initGallery();
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', initGallery);
|
||||||
|
} else {
|
||||||
|
// 延迟执行确保 Swup 容器已准备好
|
||||||
|
setTimeout(initGallery, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Resize handler
|
// Resize handler
|
||||||
if (window.galleryResizeHandler) window.removeEventListener('resize', window.galleryResizeHandler);
|
if (window.galleryResizeHandler) window.removeEventListener('resize', window.galleryResizeHandler);
|
||||||
|
|||||||
Reference in New Issue
Block a user