更改相册背景效果
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled

This commit is contained in:
2025-06-17 20:28:46 +08:00
parent 3b76900d6a
commit 3ea730b29b
2 changed files with 10 additions and 3 deletions

View File

@@ -235,7 +235,7 @@ body::after {
.photo-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(45%, 1fr));
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 2rem;
}

View File

@@ -81,6 +81,7 @@
let currentPhotos = [];
let currentRotation = 0;
// 显示相册详情
// 显示相册详情
function showAlbumDetail(album) {
currentAlbum = album;
@@ -108,7 +109,6 @@
// 添加点击事件
photoItem.addEventListener('click', () => {
currentPhotoIndex = index;
// showPhotoPreview(photo.original);
showPhotoPreview(photo.compressed);
});
@@ -117,7 +117,13 @@
entries.forEach(entry => {
if (entry.isIntersecting) {
const lazyImage = entry.target;
lazyImage.src = lazyImage.dataset.src;
const src = lazyImage.dataset.src;
// 移除data-src属性确保只加载一次
lazyImage.removeAttribute('data-src');
// 设置src属性开始加载
lazyImage.src = src;
// 图片加载完成后显示
lazyImage.onload = () => {
@@ -127,6 +133,7 @@
}
};
// 停止观察
observer.unobserve(lazyImage);
}
});