@@ -851,68 +851,146 @@ h1, h2, h3, p, li, .caption, .small {
851851}
852852
853853
854- /* ===== Mobile carousel centering fix ===== */
854+ /* 基础设置 */
855+ .carousel-container {
856+ position : relative;
857+ max-width : 1000px ;
858+ margin : 20px auto;
859+ overflow : hidden; /* 隐藏溢出 */
860+ user-select : none;
861+ -webkit-user-select : none;
862+ }
863+
864+ .carousel-window {
865+ width : 100% ;
866+ position : relative;
867+ /* 边缘虚化 */
868+ -webkit-mask-image : linear-gradient (to right, transparent 0% , black 5% , black 95% , transparent 100% );
869+ mask-image : linear-gradient (to right, transparent 0% , black 5% , black 95% , transparent 100% );
870+ }
871+
872+ .carousel-track {
873+ display : flex;
874+ gap : 15px ; /* 固定间距 15px */
875+ width : 100% ;
876+ padding : 10px 0 ;
877+ cursor : grab;
878+ will-change : transform;
879+ }
880+ .carousel-track : active { cursor : grabbing; }
881+
882+ /* --- 卡片核心样式 --- */
883+ .carousel-card {
884+ /* 电脑端默认:60% */
885+ flex : 0 0 60% ;
886+ width : 60% ;
887+
888+ transition : transform 0.4s ease, opacity 0.4s ease;
889+ opacity : 0.3 ;
890+ transform : scale (0.9 );
891+ display : flex;
892+ flex-direction : column;
893+ align-items : center;
894+ position : relative;
895+ z-index : 1 ;
896+ }
897+
898+ /* 手机端适配:75% (留出一点边给按钮) */
855899@media (max-width : 768px ) {
856- .carousel-container {
857- max-width : 100% ;
858- margin : 16px auto;
859- padding : 8px 0 44px ; /* 底部给 caption 留空间 */
860- overflow : visible;
900+ .carousel-card {
901+ flex : 0 0 75% ;
902+ width : 75% ;
861903 }
904+ }
862905
863- . carousel-window {
864- width : 100 % ;
865- overflow : hidden ;
866- -webkit-mask-image : none !important ;
867- mask-image : none !important ;
868- }
906+ /* 激活状态 */
907+ . carousel-card . is-active {
908+ opacity : 1 ;
909+ transform : scale ( 1 ) ;
910+ z-index : 10 ;
911+ }
869912
870- .carousel-track {
871- display : flex;
872- align-items : center;
873- justify-content : center; /* 关键:轨道内容居中 */
874- gap : 0 ; /* 关键:去掉间隔避免偏移 */
875- padding : 0 ;
876- transform : none !important ; /* 若 JS/旧样式有 transform,先压住 */
877- }
913+ /* 禁止动画类 (用于瞬移) */
914+ .no-transition , .no-transition * {
915+ transition : none !important ;
916+ }
878917
879- .carousel-card {
880- flex : 0 0 100% ;
881- max-width : 100% ;
882- width : 100% ;
883- margin : 0 auto;
884- opacity : 0 ;
885- transform : none !important ;
886- filter : none !important ;
887- transition : opacity .25s ease;
888- }
918+ /* --- 视频区域 --- */
919+ .video-wrapper {
920+ width : 100% ;
921+ aspect-ratio : 16 / 9 ;
922+ border-radius : 12px ;
923+ overflow : hidden;
924+ background : # 000 ;
925+ box-shadow : 0 5px 20px rgba (0 , 0 , 0 , 0.3 );
926+ transform : translateZ (0 );
927+
928+ /* 核心:彻底禁止视频层响应鼠标,让点击穿透到底下的图层 */
929+ pointer-events : none;
930+ }
889931
890- .carousel-card .is-active {
891- opacity : 1 ;
892- z-index : 2 ;
893- }
932+ .video-wrapper video {
933+ width : 100% ;
934+ height : 100% ;
935+ object-fit : cover;
936+ display : block;
937+ }
894938
895- .video-wrapper {
896- width : 100% ;
897- margin : 0 auto;
898- border-radius : 12px ;
899- }
939+ .caption {
940+ margin-top : 12px ;
941+ font-size : 16px ;
942+ font-weight : bold;
943+ color : # 333 ;
944+ text-align : center;
945+ opacity : 0 ;
946+ transition : opacity 0.3s ;
947+ }
948+ .carousel-card .is-active .caption { opacity : 1 ; }
900949
901- /* 只显示当前卡片标题,且居中 */
902- .carousel-card .caption {
903- text-align : center;
904- margin-top : 10px ;
905- font-size : 15px ;
906- line-height : 1.35 ;
907- }
950+ /* --- 按钮样式 (核弹级层级) --- */
951+ .nav-btn {
952+ position : absolute;
953+ top : 50% ;
954+ transform : translateY (-50% );
955+ width : 50px ;
956+ height : 50px ;
957+ border-radius : 50% ;
958+ background : rgba (255 , 255 , 255 , 0.95 );
959+ box-shadow : 0 4px 12px rgba (0 , 0 , 0 , 0.3 );
960+ cursor : pointer;
961+ z-index : 9999 ; /* 保证最顶层 */
962+ display : flex;
963+ align-items : center;
964+ justify-content : center;
965+ color : # 333 ;
966+ border : none;
967+ -webkit-tap-highlight-color : transparent;
968+ pointer-events : auto; /* 恢复按钮的点击 */
969+ }
908970
909- /* 按钮垂直居中到视频中线,并贴边 */
910- .nav-btn {
911- top : calc (50% - 22px ); /* 对齐视频视觉中心 */
912- width : 42px ;
913- height : 42px ;
914- z-index : 5 ;
971+ .prev-btn { left : 10px ; }
972+ .next-btn { right : 10px ; }
973+
974+ /* 手机上稍微把按钮往里收一点,防误触边缘 */
975+ @media (max-width : 768px ) {
976+ .prev-btn { left : 5px ; }
977+ .next-btn { right : 5px ; }
978+ }
979+
980+ /* 添加这段精简的移动端适配 */
981+ @media (max-width : 768px ) {
982+ .carousel-container {
983+ padding-bottom : 40px ; /* 给下方的按钮留点空间 */
984+ }
985+
986+ /* 让按钮在手机上稍微大一点,好点按 */
987+ .nav-btn {
988+ width : 44px ;
989+ height : 44px ;
990+ }
991+
992+ /* 确保视频圆角和阴影正常 */
993+ .video-wrapper {
994+ box-shadow : 0 4px 15px rgba (0 , 0 , 0 , 0.4 );
915995 }
916- .prev-btn { left : 8px ; }
917- .next-btn { right : 8px ; }
918996}
0 commit comments