Vanessa 2025-06-29 17:53:21 +08:00
parent 1a02d153e6
commit 74c2e4f106
2 changed files with 6 additions and 6 deletions

View file

@ -342,12 +342,12 @@
&-img {
height: 100%;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
object-fit: cover;
width: 100%;
object-position: center;
&--fit {
background-size: contain;
object-fit: contain;
}
}

View file

@ -71,9 +71,9 @@ export const renderGallery = (options: {
const coverClass = "av__gallery-cover av__gallery-cover--" + view.cardAspectRatio;
if (item.coverURL) {
if (item.coverURL.startsWith("background")) {
galleryHTML += `<div class="${coverClass}"><div class="av__gallery-img${view.fitImage ? " av__gallery-img--fit" : ""}" style="${item.coverURL}"></div></div>`;
galleryHTML += `<div class="${coverClass}"><img loading="lazy" class="av__gallery-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=" style="${item.coverURL}"></div>`;
} else {
galleryHTML += `<div class="${coverClass}"><div class="av__gallery-img${view.fitImage ? " av__gallery-img--fit" : ""}" style="background-image:url('${item.coverURL.replace(/'/g, "\\'")}')"></div></div>`;
galleryHTML += `<div class="${coverClass}"><img loading="lazy" class="av__gallery-img${view.fitImage ? " av__gallery-img--fit" : ""}" src="${item.coverURL}"></div>`;
}
} else if (item.coverContent) {
galleryHTML += `<div class="${coverClass}"><div class="av__gallery-content">${item.coverContent}</div><div></div></div>`;