-
Notifications
You must be signed in to change notification settings - Fork 10.2k
/
keyboard-fix.coffee
25 lines (23 loc) · 1.08 KB
/
keyboard-fix.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
if Meteor.isCordova
document.addEventListener 'deviceready', ->
if device?.platform.toLowerCase() isnt 'android'
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
window.addEventListener 'native.keyboardshow', ->
if device?.platform.toLowerCase() isnt 'android'
if Meteor.userId()?
$('.main-content').css 'height', window.innerHeight
$('.sweet-alert').css 'transform', "translateY(-#{(document.height - window.innerHeight) / 2}px)"
$('.sweet-alert').css '-webkit-transform', "translateY(-#{(document.height - window.innerHeight) / 2}px)"
else
$(document.body).css 'height', window.innerHeight
$(document.body).css 'overflow', 'scroll'
window.addEventListener 'native.keyboardhide', ->
if device?.platform.toLowerCase() isnt 'android'
if Meteor.userId()?
$('.main-content').css 'height', window.innerHeight
$('.sweet-alert').css 'transform', ''
$('.sweet-alert').css '-webkit-transform', ''
else
$(document.body).css 'height', window.innerHeight
$(document.body).css 'overflow', 'visible'