如何在 html5 全屏 iPhone 应用程序中禁用弹跳? [英] How to disable bouncing in html5 fullscreen iphone app?

查看:22
本文介绍了如何在 html5 全屏 iPhone 应用程序中禁用弹跳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作 html5 全屏应用.我制作了一个页面并将其作为图标添加到我的 iphone 中.我添加了元标记:

I want to make html5 fullscreen app. I made a page and added it as an icon to my iphone. I added metatags:

 <meta name="apple-mobile-web-app-capable" content="yes">
 <meta name="apple-mobile-web-app-status-bar-style" content="black">
 <meta name="viewport" content="width=device-width, user-scalable=no" />

我想要实现的是:顶部的黑色状态栏(这不起作用,我不知道为什么.它仍然是默认状态栏...任何人的想法?)没有缩放的可能性(如在 Facebook 应用程序中)- 这很好用.

What I wanted to achieve is: black status bar on top (this does not work and I do not know why. It is still default status bar...anyone ideas?) without possibility to zoom (like in facebook app) - this works fine.

现在的问题 - 即使我的应用适合屏幕,我也可以在我的 iphone 上滚动.它会反弹,但我不想要这种行为.我想禁用它并为特定的 div (.ui-content) 启用滚动.我怎样才能做到这一点?

Now the problem - I can scroll on my iphone even if my app fits on the screen. It bounces back, but I dont want this behavior. I would like to disable that and enable scrolling for a particular div (.ui-content). How can I achieve that?

状态栏现在是黑色的.一段时间后它自己改变了.之前的版本是缓存在iphone上还是什么?

status bar is black now. It changed itself after some time. Was the previous version cached on the iphone or what?

推荐答案

这将防止在整个页面上滚动

This will prevent scrolling on the whole page

document.ontouchmove = function(e) {e.preventDefault()};

在您的情况下,您希望某些 div 可滚动,而有些则不可滚动,您应该能够在事件到达文档之前捕获该事件

In your case, where you want some divs to be scrollable, and some not to, you should be able to catch the event before it gets to the document

scrollableDiv.ontouchmove = function(e) {e.stopPropagation()};

这篇关于如何在 html5 全屏 iPhone 应用程序中禁用弹跳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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