当前位置:网站首页>App embedded H5 --- iPhone soft keyboard blocks input text
App embedded H5 --- iPhone soft keyboard blocks input text
2022-07-07 05:01:00 【Kratial】
1. The cause of the problem
stay ios in , The soft keyboard is at the top of the page , The pop-up of the soft keyboard will not cause the height of the window to change , Therefore, the input box at the bottom will be blocked .
But in android Next , The soft keyboard is on the same level as the window , So when the soft keyboard pops up , The current window will change , Therefore, there is no such problem .
2. How to monitor the pop-up and hiding of soft keyboard
stay ios The soft keyboard will pop up when you focus in , When the focus is lost, the soft keyboard will be folded
3. Solution
(1)scrollIntoView
(2) Monitor focus and out of focus
(3) Use this scrollIntoView, Ensure that the current input box is outside the original visual area
handleFocus(elem) {
console.log(' The soft keyboard pops up ')
document.body.style.height = '100vh' + Soft keyboard height
document.querySelector('.' + elem).scrollIntoView();
}
},
handleBlur() {
document.body.style.height = '100%'
console.log(' Soft keyboard hidden ')
}
4. About scrollIntoView Introduction to
Element Interface scrollIntoView() Method scrolls the parent container of the element , Cause to be called scrollIntoView() The element is visible to the user .
Reference link :MDN—scrollIntoView
边栏推荐
- JDBC link Oracle reference code
- Code source de la fonction [analogique numérique] MATLAB allcycles () (non disponible avant 2021a)
- 3.基金的类型
- Lessons and thoughts of the first SQL injection
- leetcode 53. Maximum subarray maximum subarray sum (medium)
- What work items do programmers hate most in their daily work?
- How to design API interface and realize unified format return?
- 【数模】Matlab allcycles()函数的源代码(2021a之前版本没有)
- Chapter 9 Yunji datacanvas company has been ranked top 3 in China's machine learning platform market
- Introduction to the PureMVC series
猜你喜欢
随机推荐
IMS data channel concept of 5g vonr+
MySQL数据库(基础篇)
使用Thread类和Runnable接口实现多线程的区别
【736. Lisp 语法解析】
offer如何选择该考虑哪些因素
Canteen user dish relationship system (C language course design)
Meow, come, come: do you really know if, if else
STM32 encapsulates the one key configuration function of esp8266: realize the switching between AP mode and sta mode, and the creation of server and client
[Yugong series] go teaching course 005 variables in July 2022
Appium practice | make the test faster, more stable and more reliable (I): slice test
JS also exports Excel
A detailed explanation of head pose estimation [collect good articles]
What is JVM? What are the purposes of JVM tuning?
关于01背包个人的一些理解
C语言中函数指针与指针函数
How to design API interface and realize unified format return?
Liste des hôtes d'inventaire dans ansible (je vous souhaite des fleurs et de la romance sans fin)
[practice leads to truth] is the introduction of import and require really the same as what is said on the Internet
批量归一化(标准化)处理
How to package the parsed Excel data into objects and write this object set into the database?