最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Disable Safari 5's “overscroll” behaviour using CSS or JavaScript - Stack Overflow

programmeradmin3浏览0评论

Safari 5 on OS X Lion allows you to scroll past the visible bounds of the page, revealing a linen texture beneath it. It's a nice effect, but for some web apps – particularly those with fixed-position elements like a sidebar – it can be distracting. Does anyone know how to disable the effect using CSS or JavaScript? It must be possible, because some sites like Apple's own iCloud have done so.

Safari 5 on OS X Lion allows you to scroll past the visible bounds of the page, revealing a linen texture beneath it. It's a nice effect, but for some web apps – particularly those with fixed-position elements like a sidebar – it can be distracting. Does anyone know how to disable the effect using CSS or JavaScript? It must be possible, because some sites like Apple's own iCloud have done so.

Share Improve this question asked Jan 11, 2012 at 20:40 conmulliganconmulligan 7,1486 gold badges34 silver badges45 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 13

There is a blog post that talks about what you need to do to disable elastic scrolling on both Mac OS X and iOS devices. According to the site it appears to be as simple as the following CSS rule for desktop browsers:

body { overflow: hidden; }

This does the trick:

body,
html {
  position: fixed;
}

Tested and verified with iOS8, and iOS9.

html { overflow: hidden;}
body { overflow: scroll;}
发布评论

评论列表(0)

  1. 暂无评论