禁用Safari中的弹性滚动 [英] Disable elastic scrolling in Safari

查看:1792
本文介绍了禁用Safari中的弹性滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想在Safari(OSX Lion)中解析弹性滚动/弹跳效果

I just wanted to diable the elastic scrolling/bounce effect in Safari (OSX Lion).

我发现解决方案设置 overflow:hidden 用于css中的正文,但正如预期的那样,只有禁用滚动条,因此如果网站 >将无法滚动!

I found the solution to set overflow: hidden for body in css, but as expected it only disables the scrollbar, so if the website is "longer" than the screen you won't be able to scroll!

欢迎任何解决方案或提示!
谢谢!

Any solutions or hints are welcome! Thanks!

推荐答案

您可以通过应用以下CSS实现这一点:

You can achieve this more universally by applying the following CSS:

html,
body {
  height: 100%;
  width: 100%;
  overflow: auto;
}

这样,您的内容无论是什么都可以在 body ,但是请注意 scroll 事件被触发的滚动上下文现在 document.body ,而不是窗口

This allows your content, whatever it is, to become scrollable within body, but be aware that the scrolling context where scroll event is fired is now document.body, not window.

这篇关于禁用Safari中的弹性滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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