fix(frontend): restore banner carousel visible height
Global border-box collapsed the banner's height:0 + padding-bottom aspect box to zero, so slides rendered but took no space. Prefer aspect-ratio (with content-box fallback) and make .new-swiper honor data-swiper-config so autoplay/loop/navigation from templates apply.
This commit is contained in:
@@ -175,9 +175,20 @@
|
||||
--scale-height: 40%;
|
||||
--pc-height: 100%;
|
||||
--m-height: 100%;
|
||||
padding-bottom: var(--scale-height);
|
||||
width: 100%;
|
||||
height: 0;
|
||||
height: auto;
|
||||
/* Prefer aspect-ratio so global border-box cannot collapse the box. */
|
||||
aspect-ratio: 5 / 2;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@supports not (aspect-ratio: 1 / 1) {
|
||||
.scale-height {
|
||||
height: 0;
|
||||
padding-bottom: var(--scale-height);
|
||||
box-sizing: content-box;
|
||||
aspect-ratio: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.scale-height .swiper-wrapper,
|
||||
|
||||
@@ -330,24 +330,41 @@
|
||||
background: var(--main-bg-color, var(--surface-1));
|
||||
}
|
||||
|
||||
/*
|
||||
* Aspect-ratio card height.
|
||||
* Global reset uses box-sizing:border-box, so the classic
|
||||
* height:0 + padding-bottom trick collapses to 0 unless we
|
||||
* force content-box (or use aspect-ratio).
|
||||
*/
|
||||
.banner-module__swiper {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
padding-bottom: 40%;
|
||||
height: auto;
|
||||
aspect-ratio: 5 / 2; /* 40% */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@supports not (aspect-ratio: 1 / 1) {
|
||||
.banner-module__swiper {
|
||||
height: 0;
|
||||
padding-bottom: 40%;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
}
|
||||
|
||||
.banner-module__swiper .swiper-wrapper {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.banner-module__swiper .swiper-slide {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.banner-module__slide-bg {
|
||||
@@ -359,8 +376,10 @@
|
||||
|
||||
.banner-module__slide-bg img,
|
||||
.banner-module__slide-bg .fit-cover {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: none;
|
||||
object-fit: cover;
|
||||
border-radius: 0;
|
||||
}
|
||||
@@ -453,8 +472,16 @@
|
||||
}
|
||||
|
||||
.banner-module__swiper {
|
||||
padding-bottom: 50%;
|
||||
height: 0;
|
||||
aspect-ratio: 2 / 1; /* 50% */
|
||||
height: auto;
|
||||
}
|
||||
|
||||
@supports not (aspect-ratio: 1 / 1) {
|
||||
.banner-module__swiper {
|
||||
height: 0;
|
||||
padding-bottom: 50%;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
}
|
||||
|
||||
.banner-module__content {
|
||||
|
||||
Reference in New Issue
Block a user