feat(index):优化轮播图触摸交互支持垂直滚动- 引入touchStartRef记录触摸起始位置- 新增disableSwiper状态控制轮播图禁用
- 设置touchAction样式支持水平垂直滑动 - 调整Swiper组件direction为horizontal -为Swiper.Item添加touchAction样式优化 - 更新CSS样式确保图片点击事件正常- 添加自定义Swiper类名及触摸控制样式 - 启用-webkit-overflow-scrolling提升滚动体验
This commit is contained in:
@@ -19,23 +19,27 @@ page {
|
||||
}
|
||||
}
|
||||
|
||||
/* 轮播图容器样式,确保不阻止页面滚动 */
|
||||
/* 轮播图容器样式,确保支持两种滑动操作 */
|
||||
.banner-swiper-container {
|
||||
touch-action: pan-y !important;
|
||||
touch-action: pan-y !important; /* 允许垂直滑动 */
|
||||
|
||||
.nut-swiper {
|
||||
touch-action: pan-y !important;
|
||||
pointer-events: none; // 关键修改:禁用Swiper的指针事件
|
||||
touch-action: pan-y !important; /* 允许垂直滑动 */
|
||||
|
||||
.nut-swiper-item {
|
||||
touch-action: pan-y !important;
|
||||
pointer-events: none; // 关键修改:禁用Swiper Item的指针事件
|
||||
touch-action: pan-x pan-y !important; /* 允许水平和垂直滑动 */
|
||||
|
||||
image {
|
||||
pointer-events: auto; // 重新启用图片的指针事件,以便点击功能正常
|
||||
pointer-events: auto; /* 确保图片点击事件正常 */
|
||||
touch-action: manipulation; /* 优化触摸操作 */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 为Swiper容器添加特殊处理 */
|
||||
.nut-swiper--horizontal {
|
||||
touch-action: pan-y !important; /* 允许垂直滑动 */
|
||||
}
|
||||
}
|
||||
|
||||
/* 吸顶状态下的样式 */
|
||||
@@ -43,4 +47,30 @@ page {
|
||||
.header-bg {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* 为Swiper添加更精确的触摸控制 */
|
||||
.nut-swiper {
|
||||
touch-action: pan-y !important;
|
||||
|
||||
.nut-swiper-inner {
|
||||
touch-action: pan-x pan-y !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* 自定义Swiper样式 */
|
||||
.custom-swiper {
|
||||
touch-action: pan-y !important;
|
||||
|
||||
.nut-swiper-item {
|
||||
touch-action: pan-x pan-y !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* 确保Swiper内部元素不会阻止页面滚动 */
|
||||
.banner-swiper-container,
|
||||
.custom-swiper,
|
||||
.nut-swiper,
|
||||
.nut-swiper-item {
|
||||
-webkit-overflow-scrolling: touch; /* iOS平台启用硬件加速滚动 */
|
||||
}
|
||||
Reference in New Issue
Block a user