(This is a multi-part question, I will try my best to summarise the scenario.)((这是一个多部分的问题,我将尽力总结这个场景。))
We are currently building a responsive web app (news reader) that allow users to swipe between tabbed content, as well as scroll vertically inside each tabbed content.(我们目前正在构建一个响应式Web应用程序(新闻阅读器),允许用户在选项卡式内容之间滑动,以及在每个选项卡式内容中垂直滚动。)
A common approach to the problem is to have a wrapper div
that fills the browser viewport, set overflow
to hidden
or auto
, then scroll horizontally and/or vertically inside it.(这个问题的一个常见方法是使用一个包装器div
填充浏览器视口,将overflow
设置为hidden
或auto
,然后在其中水平和/或垂直滚动??。)
This approach is great but has one main drawback: since the height of the document is exactly the same as the browser viewport, the mobile browser will not hide the address bar/navigation menu .(这种方法很好,但有一个主要缺点: 由于文档的高度与浏览器视口完全相同,因此移动浏览器不会隐藏地址栏/导航菜单 。)
There are numerous hacks and viewport properties that enable us to get more screen real estate, but none are quite as effective as minimal-ui
(introduced in iOS 7.1).(有许多hacks和视口属性使我们能够获得更多的屏幕空间,但没有一个像minimal-ui
(在iOS 7.1中引入)那样有效。)
News came yesterday that iOS 8 beta4 had removed minimal-ui
from Mobile Safari (see Webkit section in iOS 8 Release Notes ), which left us wondering:(昨天有消息称iOS 8 beta4已从Mobile Safari中移除了minimal-ui
(参见iOS 8发行说明中的 Webkit部分),这让我们感到奇怪:)
Q1.(Q1。) Is it still possible to hide the address bar on Mobile Safari?(是否仍然可以隐藏Mobile Safari上的地址栏?)
As far as we know, iOS 7 no longer responds to the window.scrollTo
hack, this suggests we have to live with the smaller screen space, unless we adopt a vertical layout or use mobile-web-app-capable
.(据我们所知,iOS 7 不再响应 window.scrollTo
hack,这表明我们必须使用较小的屏幕空间,除非我们采用垂直布局或使用支持mobile-web-app-capable
。)
Q2.(Q2。) Is it still possible to have a similar soft fullscreen experience?(是否仍然可以获得类似的软全屏体验?)
By soft fullscreen I really mean without using the mobile-web-app-capable
meta tag.(通过软全屏我真的意味着不使用支持mobile-web-app-capable
元标记。)
Our web app is built to be accessible, any page can be bookmarked or shared using the native browser menu.(我们的Web应用程序可以访问,任何页面都可以使用本机浏览器菜单加入书签或共享。) By adding mobile-web-app-capable
we prevent users from invoking such menu (when it's saved to homescreen), which confuses and antagonises users.(通过添加支持mobile-web-app-capable
我们可以阻止用户调用此类菜单(当它保存到主屏幕时),这会混淆和对抗用户。)
minimal-ui
used to be the middle-ground, hiding the menu by default but keeping it accessible with a tap -- though Apple might have removed it due to other accessibility concerns (such as users not knowing where to tap to activate the menu).(minimal-ui
曾经是中间地带,默认隐藏菜单但是可以通过点击访问它 - 虽然Apple可能已经删除它,因为其他可访问性问题(例如用户不知道点击激活菜单的位置) 。)
Q3.(Q3。) Is a fullscreen experience worth the trouble?(全屏体验值得一试吗?)
It would seem that a fullscreen API is not coming to iOS anytime soon, but even if it is, I don't see how the menu will be kept accessible (same goes for Chrome on Android).(似乎全屏API不会很快进入iOS,但即便如此,我也看不到菜单是如何保持可访问的(Android上的Chrome也是如此)。)
In this case, maybe we should just leave mobile safari as it is, and account for viewport height (for iPhone 5+, it's 460 = 568 - 108, where 108 includes the OS bar, address bar and navigation menu; for iPhone 4 or older, it's 372).(在这种情况下,也许我们应该保持原样的移动游猎,并考虑视口高度(对于iPhone 5 +,它是460 = 568 - 108,其中108包括操作系统栏,地址栏和导航菜单;对于iPhone 4或年纪大了,它是372)。)
Would love to hear some alternatives (besides building a native app).(很想听到一些替代方案(除了构建本机应用程序)。)
ask by bitinn translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…