惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
B
Blog
D
Docker
C
Check Point Blog
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
MongoDB | Blog
MongoDB | Blog
WordPress大学
WordPress大学
Jina AI
Jina AI
罗磊的独立博客
月光博客
月光博客
博客园 - Franky
L
LangChain Blog
H
Help Net Security
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
小众软件
小众软件
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

时间的朋友

Windows 命令行密码重置 Anaconda安装 typescript 注解解读1 Konvajs Shape加载自定义图片 sshpass 使用 why-is-node-running webgl笔记 SharedArrayBuffer is not defined blender 常用快捷键 | 时间的朋友 vue -- v3.4commit提交记录2 vue2 升级vue3报错问题整理 着色器 expressjs 源码 hyper-V arch linux 网络配置 element input数字格式化 three 拼接货架 WebAudio笔记 Windows nginx重启bat脚本 vue -- v3.4commit提交记录 URI malformed vue3 -- Class 对象在组件中使用范例 | 时间的朋友 ruby 安装和升级 element-plus 老版本cascader使用卡死问题 vue3 内置Transition组件 | 时间的朋友 前端memo的实现 | 时间的朋友 Vue -- vue-class-component源码 | 时间的朋友 linux 优化脚本 typescript 装饰器 | 时间的朋友 microbundle 源码 | 时间的朋友 WSL2问题解决WslRegisterDistribution failed with error: 0x800701bc
IOS端h5 fixed滚动问题 | 时间的朋友
2023-05-11 · via 时间的朋友

Published: · LastMod: May 11, 2023 · 185 words

IOS端h5 fixed滚动问题 🔗

1
2
3
4
5
6

visualViewport.addEventListener("resize", resizeHandler);

const resizeHandler = () => {
    // ...
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// 需要针对 iOS 越界弹性滚动的情况进行边界检查
styles.left = Math.max(0, Math.min(
    document.documentElement.scrollWidth - visualViewport.width,
    visualViewport.offsetLeft
)) + 'px';

// 需要针对 iOS 越界弹性滚动的情况进行边界检查
styles.top = Math.max(0, Math.min(
    document.documentElement.scrollHeight - visualViewport.height,
    visualViewport.offsetTop
)) + 'px';

styles.width = visualViewport.width + 'px';
styles.height = visualViewport.height + 'px';

Reference 🔗

https://tkte.ch/articles/2019/09/23/iOS-VisualViewport.html

MDN VisualViewport

http://www.alloyteam.com/2020/02/14265/