diff --git a/pages/index/index.js b/pages/index/index.js index 0920df3..ab9f26e 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -832,7 +832,7 @@ Page({ if (scrollTop > 50) { // 当滚动距离超过50rpx时,开始逐渐隐藏 - const hideProgress = Math.min((scrollTop - 50) / 100, 1); // 0-1的隐藏进度 + const hideProgress = Math.min((scrollTop - 50) / 150, 1); // 0-1的隐藏进度,延长隐藏过程 searchSectionOpacity = 1 - hideProgress; searchSectionTransform = -20 * hideProgress; diff --git a/pages/index/index.wxss b/pages/index/index.wxss index d86d98e..dd3dcaa 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -27,14 +27,17 @@ page { overflow: hidden; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); will-change: opacity, transform, padding, margin, max-height; + max-height: 200rpx; /* 设置一个具体的最大高度,确保过渡效果生效 */ } -/* 顶部搜索区域完全隐藏状态 - 用于收缩高度 */ +/* 顶部搜索区域完全隐藏状态 - 用于平滑收缩高度 */ .top-hidden { max-height: 0; padding: 0; margin-bottom: 0; pointer-events: none; + opacity: 0; + transform: translateY(-100%); } /* 标题样式 */