我工作的一个Web应用程序,针对的是在台式机,平板电脑和智能手机的浏览器。
I'm working on a web app that is targeted to browsers on desktop, tablet and smartphone.
该网站的应用程序有使用灯箱实施彩盒与 IFRAME
。当浏览器窗口大小或平板电脑/手机都有它的方向改变,Javascript的code查询窗口的尺寸,以便它可以调整灯箱的一些元素。
The web app has a light box implemented using Colorbox with an iframe
. When the browser window is resized or the tablet/phone has it's orientation changed, Javascript code queries the window dimensions so that it can resize some elements of the light box.
我遇到的问题是,一切工作正常桌面(Windows中:IE,火狐,Chrome,Mac上的Safari),iPad的&放大器; iPhone,但不是在Android智能手机(HTC)和Android模拟器。
The issue I'm having is that everything works fine on desktop (Windows: IE, Firefox, Chrome, Mac: Safari), iPad & iPhone but not on the Android smartphone (HTC) and Android Emulator.
Android的总是 screen.width
, screen.height
,窗口返回的值不同.innerWidth
&放大器; window.innerHeight
时,他们从窗口的大小调整事件,该事件触发多次内部查询。
Android always returns different values for screen.width
, screen.height
, window.innerWidth
& window.innerHeight
when they're queried from inside the window's resize event, which fires multiple times.
为什么Android浏览器返回这么宽的差异在价值观和我怎么能可靠地检测浏览器窗口的宽度和高度?
在Android上,window.outerWidth和window.outerHeight是可靠的屏幕尺寸。根据你的Andr oid,innerWidth版本/高度通常是不正确。
On Android, window.outerWidth and window.outerHeight are reliably the screen size. Depending on your version of Android, innerWidth/Height is usually incorrect.
下面是一个非常好的书面记录的情况而定。
Here's a really good writeup on the situation.
上一篇:注册的MouseEnter /鼠标离开事件,在Windows窗体禁用的控件?鼠标、窗体、控件、事件
下一篇:GoogleAnalytics HitBuilders.TimingBuilderGoogleAnalytics、HitBuilders、TimingBuilder