非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。

-webkit-overflow-scrolling CSS property controls whether or not touch devices use momentum-based scrolling for a given element.

句法

auto

Use "regular" scrolling, where the content immediately ceases to scroll when you remove your finger from the touchscreen.

touch

Use momentum-based scrolling, where the content continues to scroll for a while after finishing the scroll gesture and removing your finger from the touchscreen. The speed and duration of the continued scrolling is proportional to how vigorous the scroll gesture was. Also creates a new stacking context.

形式定义

初始值 auto
适用于 scrolling boxes
继承 yes
计算值 如指定
动画类型 discrete

形式句法

auto | touch
					

范例

HTML

<div class="scroll-touch">
  <p>
    This paragraph has momentum scrolling
  </p>
</div>
<div class="scroll-auto">
  <p>
    This paragraph does not.
  </p>
</div>
					

CSS

div {
  width: 100%;
  overflow: auto;
}
p {
  width: 200%;
  background: #f5f9fa;
  border: 2px solid #eaf2f4;
  padding: 10px;
}
.scroll-touch {
  -webkit-overflow-scrolling: touch; /* Lets it scroll lazy */
}
.scroll-auto {
  -webkit-overflow-scrolling: auto; /* Stops scrolling immediately */
}
					

Results

规范

Not part of any standard. Apple has a description in the Safari CSS Reference .

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
-webkit-overflow-scrolling 非标 Chrome 不支持 No Edge 不支持 No Firefox 不支持 No IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 不支持 No Chrome Android 不支持 No Firefox Android 不支持 No Opera Android 不支持 No Safari iOS 完整支持 5 Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

非标。预期跨浏览器支持较差。

非标。预期跨浏览器支持较差。

另请参阅

元数据

  • 最后修改: