记一次踩的坑,百度的很多方法都不能用
需求:上滑到全部、热门位置,全部、热门按钮固定,下拉到所在位置跟随下来
上图:
我给html,body给了高度100%,获取body的滚动条位置一直是0;
给当前页面给高度100%;
.beat_home {
height: 100%;
overflow: hidden;
overflow-y: scroll;
}
然后获取固定位置到上面的距离
<div :class="[scrollTop>posiHeight?'beat_home_top_1':'beat_home_top']">
<div class="beat_search_n">
<div @click="switchType('all')" :class="sortType=='all'?'switch_active':''">全部</div>
<div @clic