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.
237 lines
5.3 KiB
CSS
237 lines
5.3 KiB
CSS
/* ============================================================
|
||
* AKSRT Header Slider — v5.0 Zibll-Aligned
|
||
*
|
||
* 三层架构:
|
||
* - Layer 1: Swiper 全宽轮播背景
|
||
* - Layer 2: 搜索覆盖模块
|
||
* - Layer 3: 图标卡片网格覆盖
|
||
*
|
||
* 对标 zibll 的 new-swiper 体系:
|
||
* - CSS 变量高度控制 (--pc-height / --m-height)
|
||
* - data-* 属性驱动配置
|
||
* - 缩略图分页器、视差、懒加载
|
||
* ============================================================ */
|
||
|
||
/* ============================================================
|
||
* .new-swiper 基础样式(对标 zibll)
|
||
* ============================================================ */
|
||
.aksrt-slider-wrapper {
|
||
position: relative;
|
||
margin-bottom: 20px;
|
||
border-radius: var(--main-radius, var(--radius, 8px));
|
||
overflow: hidden;
|
||
box-shadow: 0 0 10px var(--main-shadow, rgba(116, 116, 116, 0.08));
|
||
}
|
||
|
||
.new-swiper {
|
||
position: relative;
|
||
overflow: hidden;
|
||
--pc-height: auto;
|
||
--m-height: auto;
|
||
}
|
||
|
||
.new-swiper .swiper-wrapper {
|
||
height: var(--pc-height);
|
||
}
|
||
|
||
.new-swiper .swiper-slide {
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.new-swiper .swiper-slide img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
|
||
/* 懒加载预加载器 */
|
||
.new-swiper .swiper-lazy-preloader {
|
||
position: absolute;
|
||
top: 50%;
|
||
left: 50%;
|
||
width: 42px;
|
||
height: 42px;
|
||
margin: -21px 0 0 -21px;
|
||
border: 3px solid rgba(255,255,255,0.3);
|
||
border-top-color: #fff;
|
||
border-radius: 50%;
|
||
animation: aksrt-swiper-spin 0.8s linear infinite;
|
||
}
|
||
|
||
@keyframes aksrt-swiper-spin {
|
||
from { transform: rotate(0deg); }
|
||
to { transform: rotate(360deg); }
|
||
}
|
||
|
||
/* 懒加载图片 */
|
||
.new-swiper .swiper-lazy {
|
||
opacity: 0;
|
||
transition: opacity 0.3s;
|
||
}
|
||
|
||
.new-swiper .swiper-lazy.lazyloaded,
|
||
.new-swiper .swiper-slide-visible .swiper-lazy {
|
||
opacity: 1;
|
||
}
|
||
|
||
/* 缩略图分页器 */
|
||
.new-swiper .pagination-thumbnail-item {
|
||
width: 60px;
|
||
height: 40px;
|
||
border-radius: 4px;
|
||
overflow: hidden;
|
||
opacity: 0.5;
|
||
transition: opacity 0.3s, border-color 0.3s;
|
||
border: 2px solid transparent;
|
||
cursor: pointer;
|
||
display: inline-block;
|
||
}
|
||
|
||
.new-swiper .pagination-thumbnail-item img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
|
||
.new-swiper .pagination-thumbnail-item-active {
|
||
opacity: 1;
|
||
border-color: #fff;
|
||
}
|
||
|
||
/* 视差层 */
|
||
.new-swiper [data-swiper-parallax] {
|
||
transition: none;
|
||
}
|
||
|
||
/* 比例高度模式 */
|
||
.new-swiper.scale-height .swiper-wrapper {
|
||
height: 0;
|
||
padding-bottom: var(--scale-ratio, 45%);
|
||
}
|
||
|
||
/* 幻灯片文字覆盖层 */
|
||
/* zibll .slide-text / .s-desc */
|
||
.aksrt-slide-text,
|
||
.s-desc,
|
||
.slide-text {
|
||
position: absolute;
|
||
color: #fff;
|
||
z-index: 2;
|
||
text-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
|
||
}
|
||
|
||
.aksrt-slide-text,
|
||
.slide-text:not(.s-desc) {
|
||
top: 50%;
|
||
left: 50%;
|
||
transform: translate(-50%, -50%);
|
||
width: calc(100% - 32px);
|
||
max-width: 920px;
|
||
text-align: center;
|
||
background: unset;
|
||
bottom: unset;
|
||
}
|
||
|
||
.s-desc {
|
||
bottom: 0;
|
||
left: 0;
|
||
top: auto;
|
||
transform: none;
|
||
width: 100%;
|
||
padding: 1.8em 2.5em;
|
||
background: linear-gradient(0deg, rgba(0, 0, 0, 0.2), transparent);
|
||
border-radius: 0 0 var(--main-radius, 8px) var(--main-radius, 8px);
|
||
font-size: 16px;
|
||
text-align: left;
|
||
}
|
||
|
||
.aksrt-slide-text__title,
|
||
.slide-title {
|
||
font-family: var(--font-ui);
|
||
font-size: clamp(1.5rem, 3.2vw, 2.25rem);
|
||
font-weight: 600;
|
||
margin: 0 0 12px;
|
||
line-height: 1.25;
|
||
text-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
|
||
}
|
||
|
||
.s-desc .aksrt-slide-text__title,
|
||
.s-desc .slide-title {
|
||
font-size: 16px;
|
||
font-weight: normal;
|
||
}
|
||
|
||
.aksrt-slide-text__desc,
|
||
.slide-desc {
|
||
font-size: clamp(0.9rem, 1.4vw, 1.125rem);
|
||
margin: 0;
|
||
line-height: 1.6;
|
||
color: rgba(255, 255, 255, 0.95);
|
||
text-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
|
||
}
|
||
|
||
.scale-height {
|
||
--scale-height: 40%;
|
||
--pc-height: 100%;
|
||
--m-height: 100%;
|
||
width: 100%;
|
||
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,
|
||
.scale-height .swiper-slide img {
|
||
position: absolute;
|
||
}
|
||
|
||
/* 移动端高度 */
|
||
@media (max-width: 767px) {
|
||
.new-swiper .swiper-wrapper {
|
||
height: var(--m-height);
|
||
}
|
||
}
|
||
|
||
/* ============================================================
|
||
* Container — 三层叠加的父容器
|
||
* ============================================================ */
|
||
.header-slider-container,
|
||
.header-components-container {
|
||
position: relative;
|
||
isolation: isolate; /* 创建独立堆叠上下文,内部 z-index 不外泄 */
|
||
width: 100%;
|
||
margin-bottom: 24px;
|
||
}
|
||
|
||
/* ============================================================
|
||
* Device Visibility for Hero/Banner slides
|
||
* ============================================================ */
|
||
|
||
/* PC-only slides: hidden on mobile */
|
||
@media (max-width: 767.98px) {
|
||
.hero-slide--pc-only,
|
||
.banner-slide--pc-only {
|
||
display: none !important;
|
||
}
|
||
}
|
||
|
||
/* Mobile-only slides: hidden on PC */
|
||
@media (min-width: 768px) {
|
||
.hero-slide--mobile-only,
|
||
.banner-slide--mobile-only {
|
||
display: none !important;
|
||
}
|
||
}
|
||
|