当前位置:网站首页>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>
边栏推荐
- Daily question 1: force deduction: 225: realize stack with queue
- return 关键字
- [Digital IC hand tearing code] Verilog burr free clock switching circuit | topic | principle | design | simulation
- MySQL数据库基本操作-DML
- Extern keyword
- Attack and defense world ditf Misc
- 2022-07-05 stonedb的子查询处理解析耗时分析
- volatile关键字
- What are the interface tests? What are the general test points?
- SQL server generates auto increment sequence number
猜你喜欢

Crawler obtains real estate data

MySQL ---- first acquaintance with MySQL
The SQL response is slow. What are your troubleshooting ideas?

树的先序中序后序遍历

基於 QEMUv8 搭建 OP-TEE 開發環境

Advantages of link local address in IPv6

Senior soft test (Information System Project Manager) high frequency test site: project quality management

Should novice programmers memorize code?

重磅新闻 | Softing FG-200获得中国3C防爆认证 为客户现场测试提供安全保障

CCNA Cisco network EIGRP protocol
随机推荐
CCNA Cisco network EIGRP protocol
The ceiling of MySQL tutorial. Collect it and take your time
npm无法安装sharp
NetXpert XG2帮您解决“布线安装与维护”难题
Aardio - 通过变量名将变量值整合到一串文本中
将MySQL的表数据纯净方式导出
Learn the principle of database kernel from Oracle log parsing
qt quick项目offscreen模式下崩溃的问题处理
SQL Server生成自增序号
MySQL教程的天花板,收藏好,慢慢看
UDP编程
2022-07-04 mysql的高性能数据库引擎stonedb在centos7.9编译及运行
MySQL教程的天花板,收藏好,慢慢看
Inno Setup 打包及签名指南
2022-07-05 使用tpcc对stonedb进行子查询测试
Const keyword
How to use flexible arrays?
机试刷题1
POJ 1258 Agri-Net
poj 1094 Sorting It All Out (拓扑排序)