I\'m having a problem with a div element to stick to the bottom of my web app when ios 7 virtual keyboard appears after pressing a textbox.
I\'ve this div element:
Here is how we have resolved it: cordova 2.9.0. Solution 1. adding the viewport meta tag did resolve to some extent but not completely.Hence dropped it. Solution 2.
$(document).on('focus','input, select, textarea',function() {
if(OSName=== 'iOS' && ver[0] === 7){
if($(this).attr('readonly')===undefined){
$('#footer').hide()
}
}
});
$(document).on('blur','input, select, textarea',function(){
if(OSName=== 'iOS' && ver[0] === 7){
if($(this).attr('readonly')===undefined){
$('#footer').show();
}
}
});
where #footer is the id of the div whihc holds footer. This will show the toolbar for a flash of a second and the hide it, to avoid this flicker we have added some code in the native, 1.Register for the keyboardshow event in your MainViewcontroller.m add the following in the init functioon:
//fix for ios7 footer is scrolled up when the keyboard popsup.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
2.add the following function
-(void)keyboardWillShow:(NSNotification*)notification{
//call the javascript to hide the footer.
//fix for ios7 footer is scrolled along wiht the content when the keyboard comesup.
if (IsAtLeastiOSVersion(@"7.0")){
[self.webView stringByEvaluatingJavaScriptFromString:@"()"];
}
}
3.In the js file add the function
//Fix for footer is misalligned when the virtual keyboard pops up ios7
//check for device is iPhone and os version is 7
function hideFooter(){
if(OSName=== 'iOS' && ver[0] === 7){
if($(this).attr('readonly')===undefined)
$('#footer').hide();
}
}
Let us know if this solution works for u.