Search code examples
ioscordovawebviewuiwebviewmobile-website

How to get your page to scroll an input element into view when the virtual keyboard covers it?


This is done automatically when I load my website in iOS Safari and Chrome, but not done when I load it in cordova. I'd prefer a non-JS solution if possible.


Solution

  • Use: https://github.com/driftyco/ionic-plugins-keyboard

    with:

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