当前位置:网站首页>Mobile phone side scroll to page to specify location
Mobile phone side scroll to page to specify location
2022-07-30 07:52:00 【cplvfx】
scrollIntoViewOptions is very useful, but currently only supported by Chrome and FireFox, but can be implemented by other plugins (smoothscroll-polyfill)span>
Example
document.getElementById('content').scrollIntoView({block: 'start',inline: 'nearest',behavior: 'smooth'})Documentation
The first solution: the method parameter is passed "alignToTop"
Previously this parameter was well supported
scrollIntoView(alignToTop); // Boolean parameteralignToTop
A Boolean value:
- If true, the top of the element will be aligned with the top of the visible area of the scroll area it is in.
- If false, the bottom of the element will be aligned with the bottom of the visible area of the scroll area it is in.
true : The top of the element will be aligned to the top of the scrollable ancestor's visible area.Corresponds to scrollIntoViewOptions: {block: "start", inline: "nearest"} which is the defaultfalse: The bottom of the element will be aligned with the bottom of the scrollable ancestor's visible area.Corresponds to scrollIntoViewOptions: {block: "end", inline: "nearest"}.Use
document.getElementById('content').scrollIntoView(true);The second solution (such as the example): pass "scrollIntoViewOptions" as a method parameter
Currently this parameter browser does not support it well, you can check the compatibility below
element.scrollIntoView(scrollIntoViewOptions); // Object parameterbehavior: [Optional] Define the transition animation."auto", "instant" or "smooth".Defaults to "auto".block : [optional] "start" (top), "center" (center), "end" (tail) or "nearest".Defaults to "center".inline: [optional] "start", "center", "end" or "nearest".Defaults to "nearest".
Use
document.getElementById('content').scrollIntoView({block: 'start',inline: 'nearest',behavior: 'smooth'})Reference
http://mssn.midea.com/ask/?/article/230
https://zhuanlan.zhihu.com/p/342205449
边栏推荐
- 彻底删除openstack中镜像的记录
- 使用Apifox测试套件自动化测试接口
- Test Development Engineer Growth Diary 001 - Some Introduction to Agile Testing, CI/CD/CT, DecOps
- flask项目快速搭建部署gunicorn+supervisor
- 不会吧,Log4j 漏洞还没有完全修复?
- 空间顶点到直线的距离计算及其源码
- 使用 Grafana 的 Redis Data Source 插件监控 Redis
- MongoDB-CUD没有R
- Test Development Engineer Growth Diary 007 - Bug Priority Definition and Filling Specifications
- prometheus-federation-tls加密
猜你喜欢

Redis6的数据类型

阿里二面:Redis有几种集群方案?我答了4种

Rodrigues:旋转矩阵的向量表达

Multithreading basics (multithreaded memory, security, communication, thread pools and blocking queues)

Data types of Redis6

测试开发工程师成长日记018 - 测试面试必备题记录(持续更新)

Process and Scheduled Task Management

测试开发工程师成长日记017 - bug的生命周期

Network Protocol 03 - Routing and NAT

测试开发工程师成长日记001 - 敏捷测试、CI/CD/CT、DecOps的一些介绍
随机推荐
Network Protocol 03 - Routing and NAT
作为测试leader,考察求职者的几个方面
Interactively compose graphs in GraphScope based on the JupyterLab plugin
你被MySQL 中的反斜杠 \\坑过吗?
idea内置翻译插件
STL source code analysis: conceptual understanding of iterators, and code testing.
阿里二面:列出 Api 接口优化的几个技巧
prometheus-tls加密
AI元学习引入神经科学,医疗效果有望精准提升
Application of graph computing in network security analysis
prometheus-Federation机制配置
引导过程与服务控制
MongoDB-CUD without R
软件测试开发:发送第一封测试报告邮件
空间平面相交的直线的计算及其源码
05-Theos
Install MySQL under Linux (centos7)
MongoDB - query
Test Development Engineer Growth Diary 018 - Record of Required Questions for Test Interview (Continuous Update)
prometheus监控nacos