Loren
Loren

Reputation: 14846

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.

Upvotes: 13

Views: 1054

Answers (1)

Loren
Loren

Reputation: 14846

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%'

Upvotes: 3

Related Questions