uniapp滑动屏幕某一元素自动吸顶

css实现

<view class="ComBox">
		<view class="slot-wrap">
			<view class="nav_search" :style="'top:'+navTop+'px'">
				<!-- 搜索框 -->
				<u-search placeholder="请输入关键字" v-model="keyword" ></u-search>
			</view>
			<!-- 轮播图 -->
			<view style="margin-top: 5px;">
				<u-swiper :list="ad_list" name='img' :height="200"></u-swiper>
			</view>
			<!-- 分类 -->
			<view class="sort-area">
				
			</view>
		</view>
        <!-- 吸顶 -->
		<view class="suggest-top">
			<view @click="showGoods" class="left-item" :class="change == 1?'active':''">
				精选团购
			</view>
			<view @click="showShop" class="left-item" :class="change == 2?'active':''">
				推荐商户
			</view>
		</view>
        <!-- 内容1 -->
		<view class="content" v-if="change == 1">
            <scroll-view scroll-y="true" class="fullHeight" scroll-top="0" show-scrollbar="true" @scrolltolower="bottomLoad()"></scroll-view>
        </view>
		<!-- 内容2 -->
		<view class="content" v-if="change == 2"></view>
	</view>
.ComBox {
		height: auto;
		position: relative;

		.suggest-top {
			position: sticky !important;
			z-index: 999;
			top: var(--window-top);
			width: 100%;
			height: 50px;
			line-height: 50px;
			display: flex;
			justify-content: space-between;
			text-align: center;
			background-color: #fff;
		}

		.fullHeight {
			margin-top: 5px;
			height: calc(100vh - var(--window-bottom) - var(--window-top) - 65px);
			// border: #06c 1px solid;
		}
	}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值