当前位置:网站首页>uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)
uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)
2022-07-06 14:55:00 【我是开心呀】
滑动后tab固定到顶部
<template>
<view class="topBox" :class="head==1?'topBoxStyle':''">测试固定顶部测试固定顶部</view>
</template>
<script>
export default {
data(){
return{
head: 0,
myScroll:0,
}
},
onLoad(e) {
//获取目标板块到顶部的距离
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>
边栏推荐
- pytorch_ Yolox pruning [with code]
- Anaconda installs third-party packages
- 第3章:类的加载过程(类的生命周期)详解
- i. Mx6ull build boa server details and some of the problems encountered
- PVL EDI 项目案例
- anaconda安装第三方包
- How do I write Flask's excellent debug log message to a file in production?
- Aardio - 通过变量名将变量值整合到一串文本中
- UDP编程
- 2022-07-04 mysql的高性能数据库引擎stonedb在centos7.9编译及运行
猜你喜欢

C # realizes crystal report binding data and printing 4-bar code

Daily question 1: force deduction: 225: realize stack with queue

Aardio - 封装库时批量处理属性与回调函数的方法

Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)
![[Digital IC hand tearing code] Verilog burr free clock switching circuit | topic | principle | design | simulation](/img/2b/15b3d831bba6aa772ad83f3ac91d23.png)
[Digital IC hand tearing code] Verilog burr free clock switching circuit | topic | principle | design | simulation

Config:invalid signature solution and troubleshooting details

HDR image reconstruction from a single exposure using deep CNN reading notes

Spatial domain and frequency domain image compression of images

Unity3d minigame unity webgl transform plug-in converts wechat games to use dlopen, you need to use embedded 's problem

Assembly and Interface Technology Experiment 6 - ADDA conversion experiment, AD acquisition system in interrupt mode
随机推荐
做国外LEAD2022年下半年几点建议
A Mexican airliner bound for the United States was struck by lightning after taking off and then returned safely
ResNet-RS:谷歌领衔调优ResNet,性能全面超越EfficientNet系列 | 2021 arxiv
Web APIs DOM time object
做接口测试都测什么?有哪些通用测试点?
void关键字
[leetcode daily clock in] 1020 Number of enclaves
Plafond du tutoriel MySQL, bien collecté, regardez lentement
CCNA-思科网络 EIGRP协议
剪映+json解析将视频中的声音转换成文本
CocosCreator+TypeScripts自己写一个对象池
UDP编程
MySQL数据库基本操作-DML
OpenCV VideoCapture. Get() parameter details
基于 QEMUv8 搭建 OP-TEE 开发环境
Management background --3, modify classification
Classic sql50 questions
anaconda安装第三方包
重磅新闻 | Softing FG-200获得中国3C防爆认证 为客户现场测试提供安全保障
Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)