iPhone& iPad位置:固定底部问题 [英] iPhone & iPad position: fixed bottom problem

查看:435
本文介绍了iPhone& iPad位置:固定底部问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://t1.kameleo.ch/

如果向下滚动,您会在页脚下找到一个登录按钮。如果你点击它,登录会出现在屏幕的底部。

if you scroll down you will find a login button under the footer. If you click it, the login appears on the bottom of the screen.

我已经做了相对于页面底部的固定定位。这在每个浏览器工作正常,期望移动设备,如iPad和iPhone。

I have done this with a negative fixed positioning relative to the bottom of the page. This works fine in every browser, expect for mobile devices such as the iPad and the iPhone. The login bar appears on the middle of the screen.

iPhone上的屏幕截图:
http://img844.imageshack.us/i/photoe.png/

Screenshot on iPhone: http://img844.imageshack.us/i/photoe.png/

有人知道一个有关这方面的工作?

Does anyone know a work around for this?

推荐答案

发生的原因是iOS浏览器使用一个窗口移动的视口,这意味着固定位置相对于窗口是固定的,而不是视口。您需要使用JavaScript通过检查当前视口位置来定位它。

The reasons this happens is that the iOS browsers use a viewport that moves around the window, that means that fixed position is fixed in regards to the window, but not the viewport. You'll need to position it using JavaScript by checking the current viewport position.

这篇关于iPhone& iPad位置:固定底部问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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