leecade / leecade/webapp-debug
H5 键盘挡住输入框
Open
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
- 输入框获取交焦点之后,使用定时器循环判断浏览器可视窗口的大小,然后设置整个页面的滚动距离。
$('input').on('focus', function() {
var h = this.offsetHeight,
t = this.offsetTop;
var timer = setInterval(function() {
var hs2 = document.documentElement.clientHeight || document.body.clientHeight;
var tH = window.scrollY;
if (isAndroid && hScreen>hs2) {
//使用原生
// document.body.scrollTop = hScreen - hs2;
// document.documentElement.scrollTop = hScreen - hs2;
// 使用zepto.js库
$(document).scrollTop(hScreen - hs2);
clearInterval(timer);
}
}, 100)
})
- 给浏览器添加resize事件,然后判断输入框时候获取当前页面的焦点,
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests; start by locating the H5 input and focus handling. Compare the timer and resize-event approaches described, and verify that the focused input remains visible when the Android keyboard opens.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript
- Domain
- frontend, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100