如何隐藏和显示iPhone上的键盘使用Phonegap和javascript [英] How to hide and show the keyboard on an iPhone using Phonegap and javascript

查看:147
本文介绍了如何隐藏和显示iPhone上的键盘使用Phonegap和javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Phonegap应用程序中,我有一个屏幕,如果用户点击或点击textarea之外,键盘应该隐藏。我使用 .blur(函数,但是通过这样做,屏幕上升,用户不能看到顶部的应用程序栏(屏幕本身不移动调用模糊后,尝试 window.scrollTo(0,0) c $ c>。



如果我记得正确,你可能需要把它包装在一个0ms setTimeout

  $('#someInput')。blur(); 
setTimeout(function(){
window.scrollTo(0,0);
} 0);


In my Phonegap application, I have one screen where if the user taps or clicks outside of the textarea, the keyboard should hide. I used the .blur( function, but by doing that the screen goes up and the user can't see the application bar on the top (the screen itself doesn't move though).

解决方案

After calling blur, try window.scrollTo(0,0).

If I recall correctly, you might have to wrap it in a 0ms setTimeout

$('#someInput').blur();
setTimeout(function(){
  window.scrollTo(0, 0);
}, 0);

这篇关于如何隐藏和显示iPhone上的键盘使用Phonegap和javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆