如何在虚拟键盘覆盖输入元素时将页面滚动到视图中?

Lor*_*ren 11 uiwebview webview mobile-website ios cordova

这是在我在iOS Safari和Chrome中加载我的网站时自动完成的,但是当我在cordova中加载它时没有完成.如果可能的话,我更喜欢非JS解决方案.

Lor*_*ren 3

使用: https: //github.com/driftyco/ionic-plugins-keyboard

和:

window.addEventListener 'native.keyboardshow', (e) ->
  cur_height = $('body').height()
  $('body').height cur_height - e.keyboardHeight

window.addEventListener 'native.keyboardhide', (e) ->
  $('body').height '100%'
Run Code Online (Sandbox Code Playgroud)