当前位置:网站首页>Slide the uniapp to a certain height and fix an element to the top effect demo (organize)
Slide the uniapp to a certain height and fix an element to the top effect demo (organize)
2022-07-06 22:34:00 【I'm happy】
After sliding tab Fixed to the top
<template>
<view class="topBox" :class="head==1?'topBoxStyle':''"> Test fixed top test fixed top </view>
</template>
<script>
export default {
data(){
return{
head: 0,
myScroll:0,
}
},
onLoad(e) {
// Get the distance from the target plate to the top
uni.createSelectorQuery().select('.topBox').boundingClientRect(res=>{
this.myScroll =res.top;
console.log(this.myScroll,'this.myScroll-------')
}).exec();
},
methods: {
onPageScroll(e){
// console.log(e,'eeeee')
if(e.scrollTop > this.myScroll){
this.temp= 1
}else{
this.temp= 0
}
},
}
}
</script>
<style>
.boxStyle{
width: 100%;
height: 80rpx;
position: fixed;
top: 0;
left: 0;
background: #fff;
}
</style>
边栏推荐
猜你喜欢
自定义 swap 函数
NetXpert XG2帮您解决“布线安装与维护”难题
Memorabilia of domestic database in June 2022 - ink Sky Wheel
NPDP certification | how do product managers communicate across functions / teams?
软考高级(信息系统项目管理师)高频考点:项目质量管理
在IPv6中 链路本地地址的优势
将MySQL的表数据纯净方式导出
Signed and unsigned keywords
树的先序中序后序遍历
Self made j-flash burning tool -- QT calls jlinkarm DLL mode
随机推荐
General implementation and encapsulation of go diversified timing tasks
Comparison between variable and "zero value"
Clip +json parsing converts the sound in the video into text
Attack and defense world miscall
poj 1094 Sorting It All Out (拓扑排序)
Inno Setup 打包及签名指南
变量与“零值”的比较
uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)
【LeetCode】19、 删除链表的倒数第 N 个结点
POJ 1258 Agri-Net
重磅新闻 | Softing FG-200获得中国3C防爆认证 为客户现场测试提供安全保障
Self made j-flash burning tool -- QT calls jlinkarm DLL mode
sizeof关键字
MySQL教程的天花板,收藏好,慢慢看
关于声子和热输运计算中BORN电荷和non-analytic修正的问题
qt quick项目offscreen模式下崩溃的问题处理
How to confirm the storage mode of the current system by program?
Jafka来源分析——Processor
Sword finger offer question brushing record 1
Installation and use of labelimg