
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
testData: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
testData2: [1, 2, 3, 4, 5, 10],
//是否显示 悬停布局
isshow:false,
//悬浮布局的数据
toptexxt:""
},
onLoad: function () {
},
/**
* 页面加载完成
*/
onReady: function () {
},
/**
* 页面滚动监听
*/
onPageScroll: function (e) {
//console.log(e)
let that = this
let query = wx.createSelectorQuery()
query.selectAll(".section-cell").boundingClientRect(function (res) {
console.log(res)
let size =res.length
let position = -1
let topshow = -1000//根据需求设置大小
let i=0
//根据 top 的 大小 获取 当前距离顶部最近的view 的下标, 负数最大值 或者是0,
for(i=0i<sizei++){0
let top = res[i].top
if(top<=0 &&top>topshow ){
topshow = top
position=i
}
}
console.log("当前坐标是 position = "+position)
let isshow =false
if (res[0].top<0){
if(position==-1) position=0
isshow = true
}
that.setData({
isshow: isshow,
toptexxt: isshow?that.data.testData[position]:""
})
}).exec()
},
})
<!--index.wxml-->
<view>
<view class='header'>这里是header</view>
<view hidden='{{!isshow}}'>
<view class= "section-header section-fixed" >这是section-header {{toptexxt}}</view>
</view>
<view wx:for="{{testData}}" wx:key="{{testData}}">
<view>
<view class='section-cell' id='top{{item}}'>{{item}} </view>
<view wx:for="{{testData2}}" wx:key="{{testData2}}">
<view class='section-cell2' id='child{{item}}'>{{item}}</view>
</view>
</view>
</view>
</view>
/**index.wxss**/
.section-placeholder {
background-color: white
}
.section-fixed {
position: fixed
top: 0
}
.header {
height: 300rpx
width: 750rpx
background-color: bisque
}
.section-header {
height: 80rpx
width: 750rpx
background-color: rebeccapurple
}
.section-cell {
width: 750rpx
height:80rpx
background-color: gold
margin-top: 2rpx
}
.section-cell2 {
height: 50rpx
width: 750rpx
background-color: darkred
}
图片效果
1.解锁手机,在界面上找到“设置”,点击进入设置选项。2.然后在”设置“的页面下滑找到”通用“,点击进入。
3.进入设置页面后,找到“辅助功能”,点击进入辅助功能设置页。
4.进入页面后,往下方滑动页面,找到“AssistiveTouch”的选项,点击进入设置页面...
5.然后点击”AssistiveTouch“右侧的按钮选择开启,然后就可以将悬浮窗口显示。
扩展资料:
延长iPhone手机电池寿命的小技巧:
1.养成充电好习惯
在苹果手机提示低电量的时候及时充电,避免电量过低引起自动关机,如果电池效率低于80%尽量将电池更换。
2.打开优化充电
该功能可以智能的学习和判断用户的使用及充电习惯,使充电过程更加平衡,从而减缓电池的老化,并在一定程度上提升iPhone的续航能力。
查看方法:“优化电池充电”功能可在设置-电池-电池健康中查看~
3.禁止后台应用程序刷新
应用程序在后台运行时使用电池寿命。你可以看到应用程序在后台运行了多少时间。如果某个应用程序在不使用它时耗尽了太多电量,则可以禁用后台应用程序刷新以防止它在后台运行。如果应用程序过度耗电的话,我们也可以选择将其卸载!
4.启用低电量模式
“低电量模式”(Low Power Mode)功能,可让手机更省电。启用低电量模式后,你的屏幕略微变暗,限制后台进程,使处理器略微变慢,或者在正常使用时降低设备所需的能量。
*** 作方法:启用此功能最简单方法是从iPhone的右上角向下滑动,然后电池图标即可。或者你可以在设置>电池>低功率模式中启用低功率模式。
5.关闭某些APP推送
推送应用程序通知、电子邮件读取的通知等等都会缩短电池寿命,因此要想让iPhone手机电池寿命更长,最好将其关闭。可以在“设置”,对每个应用程序进行编辑,关闭通知。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)