ipad Safari:禁用滚动和反弹效果? [英] ipad safari: disable scrolling, and bounce effect?
问题描述
我正在开发基于浏览器的应用程序,目前我正在为 ipad Safari 浏览器开发和设计样式.
我在 ipad 上寻找两件事:如何为不需要的页面禁用垂直滚动?&如何禁用弹性反弹效果?
此答案不再适用,除非您正在为非常旧的 iOS 设备开发...请参阅其他解决方案><小时>
2011 答案:对于在 iOS Safari 中运行的 web/html 应用程序,您需要类似的东西
document.ontouchmove = function(event){event.preventDefault();}
对于 iOS 5,您可能需要考虑以下内容:文档.iOS 5 上的 ontouchmove 和滚动
2014 年 9 月更新:更彻底的方法可以在这里找到:https://github.com/luster-io/prevent-过度滚动.对于这一点和大量有用的 webapp 建议,请参阅 http://www.luster.io/blog/9-29-14-mobile-web-checklist.html
2016 年 3 月更新:最后一个链接不再有效 - 请参阅 https://web.archive.org/web/20151103001838/http://www.luster.io/blog/9-29-14-mobile-web-checklist.html 代替存档版本.感谢@falsarella 指出这一点.
I'm working on a browser based app, currently I'm developing and styling for the ipad safari browser.
I'm looking for two things on the ipad: How can I disable vertical scrolling for pages that don't require it? & how can I disable the elastic bounce effect?
This answer is no longer applicable, unless you are developing for a very old iOS device... Please see other solutions
2011 answer: For a web/html app running inside iOS Safari you want something like
document.ontouchmove = function(event){
event.preventDefault();
}
For iOS 5 you may want to take the following into account: document.ontouchmove and scrolling on iOS 5
Update September 2014:
A more thorough approach can be found here: https://github.com/luster-io/prevent-overscroll. For that and a whole lot of useful webapp advice, see http://www.luster.io/blog/9-29-14-mobile-web-checklist.html
Update March 2016: That last link is no longer active - see https://web.archive.org/web/20151103001838/http://www.luster.io/blog/9-29-14-mobile-web-checklist.html for the archived version instead. Thanks @falsarella for pointing that out.
这篇关于ipad Safari:禁用滚动和反弹效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!