ios7键盘,当它打开时收缩web-app [英] ios7 keyboard, when it opens shrinks web-app

查看:117
本文介绍了ios7键盘,当它打开时收缩web-app的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个适用于iPad的网络应用程序。该应用程序使用iPad键盘,在打开键盘之前它将覆盖应用程序,现在使用ios7键盘出现后应用程序缩小到剩余空间。

I have a web-app for iPad. The app uses the iPad keyboard, before when opening the keyboard it would cover the app, now with ios7 the app gets shrinked to the remaining space after the keyboard appears.

是否可以在JavaScript中更改此内容并保留旧行为?

Is it possible to change this in JavaScript, and keep the old behavior?

编辑: 我刚注意到,如果我在safari上打开应用程序就像以前一样,当我将应用程序添加到主屏幕时会出现问题。

I just noticed that if I open the app on safari it works just like before, the problem appears when I add the app to the main screen.

编辑:我几乎解决了这个问题,但后来遇到了其他问题。

I almost solved this, but then I got some other problems.

首先我添加了 height = device-height 到我使用的元标记:

First I added this height=device-height to the meta tag I was using:

<meta name = "viewport" content = "user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width, height=device-height">

但是我的应用程序的一小部分(iPad顶部栏的大小)将隐藏在底端。所以我这样做了:

But then a small part of my app (the size of the iPad top bar) would be hidden at the bottom. So I did this:

$("#my_app").css("height",window.innerHeight);

当我再次打开应用程序时,它非常完美。但是当我打开键盘时,它会向上移动,当我关闭键盘时它不会下降。所以现在iPad底部是一条黑线,应用程序有点隐藏在iPad的顶部栏下。

When I opened the app again it was perfect. But when I open the keyboard, it moves up and wont come down when I close the keyboard. So now at the bottom of the iPad is a black line, and the app is a little bit hidden under the top bar of the iPad.

任何人都可以帮忙解决这个问题。 ?

Can any one help with this?

推荐答案

解决方案最终非常简单。

The solution ended up being very simple.

I再次移除了这个 height = device-height ,然后离开了这个 $(#my_app)。css(height,window.innerHeight) ; 并且每件事情都很好。

I removed this height=device-height again, and just left this $("#my_app").css("height",window.innerHeight); and every thing was fine again.

这篇关于ios7键盘,当它打开时收缩web-app的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆