Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 531
Loren Avatar asked Mar 28 '15 02:03

Loren


1 Answers

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%'
like image 196
Loren Avatar answered Oct 13 '22 01:10

Loren