{"id":10345,"date":"2022-03-07T22:15:33","date_gmt":"2022-03-07T14:15:33","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=10345"},"modified":"2022-05-12T20:01:41","modified_gmt":"2022-05-12T12:01:41","slug":"10-css-scroll-scrollbar","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2022\/03\/10-css-scroll-scrollbar\/","title":{"rendered":"\u4ecb\u7ecd8\u4e2a\u548c\u6eda\u52a8\u76f8\u5173\u7684CSS\u5c5e\u6027"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=10345\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=10345<\/a> \u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<br \/>\n\u672c\u6587\u6b22\u8fce\u5206\u4eab\u4e0e\u805a\u5408\uff0c\u5168\u6587\u8f6c\u8f7d\u5c31\u4e0d\u5fc5\u4e86\uff0c\u5c0a\u91cd\u7248\u6743\uff0c\u5708\u5b50\u5c31\u8fd9\u4e48\u5927\uff0c\u82e5\u6025\u7528\u53ef\u4ee5\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202203-scroll.jpg';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/scroll-cover.jpg\" width=\"480\" height=\"294\" alt=\"\u6eda\u6eda\u5c01\u9762\u56fe\" class=\"alignright clip thumb size-medium\" \/><\/p>\n<h3>\u7d22\u5f15<\/h3>\n<ul>\n<li><a href=\"#scrollsnap\">Scroll Snap<\/a><\/li>\n<li><a href=\"#scroll-behavior\">scroll-behavior<\/a><\/li>\n<li><a href=\"#overscroll-behavior\">overscroll-behavior<\/a><\/li>\n<li><a href=\"#overflow-anchor\">overflow-anchor<\/a><\/li>\n<li><a href=\"#scrollbar-width\">scrollbar-width<\/a><\/li>\n<li><a href=\"#scrollbar-color\">scrollbar-color<\/a><\/li>\n<li><a href=\"#scrollbar-gutter\">scrollbar-gutter<\/a><\/li>\n<li><a href=\"#overflow-scrolling\">-webkit-overflow-scrolling<\/a><\/li>\n<\/ul>\n<h3 id=\"scrollsnap\">Scroll Snap<\/h3>\n<p>Scroll Snap \u662f\u4e00\u4e2a CSS \u72ec\u7acb\u6a21\u5757\uff0c\u53ef\u4ee5\u8ba9\u6eda\u52a8\u5143\u7d20\u505c\u6b62\u7684\u65f6\u5019\u6709\u5438\u9644\u6548\u679c\uff0c\u975e\u5e38\u5bb9\u6613\u5b9e\u73b0\u7c7b\u4f3c Swiper \u8fd9\u79cd\u4ea4\u4e92\uff0c\u751a\u81f3\u662f\u90a3\u79cd\u53ef\u4ee5\u6ed1\u6765\u6ed1\u53bb\u7684\u9009\u9879\u5361\u4ea4\u4e92\u6548\u679c\u3002<\/p>\n<p>\u4f8b\u5982\u4e0b\u9762\u89c6\u9891\u6240\u793a\u7684\u6548\u679c\uff08\u4e0d\u52a8\u70b9\u51fb\u64ad\u653e\uff09\uff1a<\/p>\n<p><video src='\/\/image.zhangxinxu.com\/video\/blog\/202203\/swipe.mp4' type=\"video\/mp4\" width=\"360\" height=\"138\" preload=\"auto\" autoplay autobuffer loop x-webkit-airplay=\"allow\" x5-video-player-type=\"h5\" x5-video-player-fullscreen=\"true\" x5-video-orientation=\"portraint\" webkit-playsinline=\"true\" playsinline=\"true\" \u200b\u200b\u200b\u200bposter=\"\/\/image.zhangxinxu.com\/image\/blog\/201806\/poster.png\"><\/video><\/p>\n<p>\u4e5f\u53ef\u4ee5\u8bbf\u95ee\u8fd9\u91cc\u4f53\u9a8c\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202203\/css-snap-scroll-swipe-demo.php\" class=\"a_link\" target=\"_blank\">Scroll Snap \u6a21\u62df Swipe \u8f6e\u64ad\u6548\u679cdemo<\/a><\/p>\n<p>\u5173\u4e8e Scroll Snap \u7684\u8bed\u6cd5\u7b49\u4fe1\u606f\u53ef\u4ee5\u53c2\u89c1\u6211\u591a\u5e74\u524d\u4ecb\u7ecd\u7684\u6587\u7ae0\uff1a\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2018\/11\/know-css-scroll-snap\/\">\u5927\u4fa0\uff0c\u8bf7\u7559\u6b65\uff0c\u8981\u4e0d\u8fc7\u6765\u4e86\u89e3\u4e0bCSS Scroll Snap\uff1f<\/a>\u201d<\/p>\n<p>\u76ee\u524d\u8be5\u6a21\u5757\u7684\u517c\u5bb9\u6027\u5df2\u7ecf\u53ef\u4ee5\u653e\u5fc3\u5927\u80c6\u5728\u79fb\u52a8\u7aef\u4f7f\u7528\u4e86\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/2022-03-07_194548.png\" alt=\"Scroll Snap 2022\u5e74\u517c\u5bb9\u6027\" width=\"630\" height=\"263\"><\/p>\n<h3 id=\"scroll-behavior\">scroll-behavior<\/h3>\n<p><code>scroll-behavior<\/code> \u53ef\u4ee5\u8ba9\u6eda\u52a8\u5bb9\u5668\u51fa\u73b0\u951a\u70b9\u5b9a\u4f4d\uff0c\u6216\u8005 JS \u8bbe\u7f6e scrollLeft\/scrollTop \u6eda\u52a8\u8ddd\u79bb\u65f6\u5019\u8868\u73b0\u4e3a\u5e73\u6ed1\u5b9a\u4f4d\u3002<\/p>\n<pre>.scroll-container {\r\n    scroll-behavior: smooth;    \r\n}<\/pre>\n<p>\u8fd9\u91cc\u6709\u4e2ademo\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/201810\/css-scroll-behavior.php\" class=\"a_link\" target=\"_blank\">CSS scroll-behavior\u9009\u9879\u5361\u5e73\u6ed1\u6eda\u52a8demo<\/a><\/p>\n<p>\u901a\u8fc7\u6eda\u52a8\u4f4d\u7f6e\u89e6\u53d1\u7684\u9009\u9879\u5361\u5207\u6362\uff0c\u7eaf CSS \u5b9e\u73b0\uff0c\u6548\u679c\u53c2\u89c1\u4e0b\u9762\u7684\u89c6\u9891\uff0c\u4e0d\u52a8\u70b9\u51fb\u64ad\u653e\uff1a<\/p>\n<p><video src='\/\/image.zhangxinxu.com\/video\/blog\/202203\/tab-smooth.mp4' type=\"video\/mp4\" width=\"616\" height=\"248\" preload=\"auto\" autoplay autobuffer loop x-webkit-airplay=\"allow\" x5-video-player-type=\"h5\" x5-video-player-fullscreen=\"true\" x5-video-orientation=\"portraint\" webkit-playsinline=\"true\" playsinline=\"true\" \u200b\u200b\u200b\u200bposter=\"\/\/image.zhangxinxu.com\/image\/blog\/201806\/poster.png\"><\/video><\/p>\n<p>\u5173\u4e8e\u8fd9\u4e2a\u5c5e\u6027\u66f4\u591a\u77e5\u8bc6\u53ef\u4ee5\u53c2\u89c1\u6211\u4e4b\u524d\u5199\u7684\u8fd9\u7bc7\u6587\u7ae0\uff1a\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2018\/10\/scroll-behavior-scrollintoview-%E5%B9%B3%E6%BB%91%E6%BB%9A%E5%8A%A8\/\">CSS scroll-behavior\u548cJS scrollIntoView\u8ba9\u9875\u9762\u6eda\u52a8\u5e73\u6ed1<\/a>\u201d<\/p>\n<p><code>scroll-behavior<\/code> \u5c5e\u6027 Safari 15.4 \u5df2\u7ecf\u5f00\u59cb\u652f\u6301\uff0c\u4e0d\u4e45\u4e4b\u540e\u5c31\u53ef\u4ee5\u5927\u89c4\u6a21\u4f7f\u7528\u4e86\uff0c\u5176\u5b9e\u73b0\u5728\u4e5f\u53ef\u4ee5\uff08Safari JS\u6253\u4e2a\u8865\u4e01\uff09\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/2022-03-07_195956.png\" width=\"549\" height=\"260\" alt=\"scroll-behavior\u517c\u5bb9\u6027\"><\/p>\n<h3 id=\"overscroll-behavior\">overscroll-behavior<\/h3>\n<p><code>overscroll-behavior<\/code> \u5c5e\u6027\u53ef\u4ee5\u8ba9\u6eda\u52a8\u5d4c\u5957\u65f6\u7236\u6eda\u52a8\u4e0d\u89e6\u53d1\uff0c\u6bd4\u65b9\u8bf4\u5f39\u6846\u4e2d\u7684\u6eda\u52a8\u6eda\u5230\u5e95\u90e8\u7684\u65f6\u5019\uff0c\u80cc\u540e\u7684\u9875\u9762\u4f1a\u7eb9\u4e1d\u4e0d\u52a8\u3002<\/p>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u7684\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202001\/css-overscroll-behavior-demo.php\" rel=\"noopener\" target=\"_blank\">CSS overscroll-behavior\u7a97\u4f53\u6eda\u52a8\u963b\u6b62demo<\/a><\/p>\n<p>\u793a\u610f Gif \u5982\u4e0b\uff0c\u70b9\u51fb\u64ad\u653e\uff1a<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202001\/overscroll-demo.png\" width=\"330\" height=\"256\" alt=\"\u6eda\u52a8\u5230\u5e95\u90e8\u4e0d\u518d\u6eda\u52a8GIF\u793a\u610f\" class=\"alignnone size-medium\" onclick=\"this.src=this.src.replace('.png','.gif');\"><\/p>\n<p>\u8fd9\u4e2aCSS\u5c5e\u6027\u6211\u4e4b\u524d\u4e5f\u8be6\u7ec6\u4ecb\u7ecd\u8fc7\uff0c\u53ef\u4ee5\u8bbf\u95ee\u8fd9\u91cc\uff1a\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/01\/css-overscroll-behavior\/\">CSS overscroll-behavior\u8ba9\u6eda\u52a8\u5d4c\u5957\u65f6\u7236\u6eda\u52a8\u4e0d\u89e6\u53d1<\/a>\u201d\u3002<\/p>\n<p>\u76ee\u524d\u7684\u517c\u5bb9\u6027\u5982\u4e0b\uff0cSafari \u51c6\u5907\u652f\u6301\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/2022-03-07_200535.png\" width=\"559\" height=\"257\" alt=\"overscroll-behavior 2022\u5e74\u517c\u5bb9\u6027\"><\/p>\n<h3 id=\"overflow-anchor\">overflow-anchor<\/h3>\n<p><code>overflow-anchor<\/code> \u5c5e\u6027\u6211\u4e4b\u524d\u4e5f\u4ecb\u7ecd\u8fc7\uff0c\u8be6\u89c1\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/08\/css-overflow-anchor\/\">CSS overflow-anchor\u5c5e\u6027\u4e0e\u6eda\u52a8\u951a\u5b9a<\/a>\u201d\u4e00\u6587\u3002<\/p>\n<p>\u8fd9\u4e2a\u5c5e\u6027\u4f5c\u7528\u662f\u8ba9\u9875\u9762\u56fe\u7247\u52a8\u6001\u52a0\u8f7d\u4e86\u5f88\u591a\u5185\u5bb9\u7684\u65f6\u5019\uff0c\u5f53\u524d\u89c6\u533a\u7684\u5185\u5bb9\u4fdd\u6301\u4e0d\u53d8\u3002<\/p>\n<p>\u4f8b\u5982\u770b\u6f2b\u753b\uff0c\u4e0a\u9762\u6709\u4e9b\u6f2b\u753b\u56fe\u7247\u8fd8\u6ca1\u52a0\u8f7d\u597d\uff0c\u4f60\u5df2\u7ecf\u770b\u5230\u540e\u9762\uff0c\u6b64\u65f6\uff0c\u5982\u679c\u4e0a\u9762\u7684\u56fe\u7247\u52a0\u8f7d\u6b63\u5e38\uff0c\u9ad8\u5ea6\u6491\u9ad8\uff0c\u5219\u5f53\u524d\u4f60\u770b\u7684\u6f2b\u753b\u4f4d\u7f6e\u4f1a\u7eb9\u4e1d\u4e0d\u52a8\uff0c\u4e0d\u4f1a\u88ab\u63a8\u4e0b\u6765\u3002<\/p>\n<p>\u8fd9\u5c31\u662f <code>overflow-anchor<\/code> \u5c5e\u6027\u7684\u4f5c\u7528\u3002<\/p>\n<p>\u76ee\u524d Safari \u6d4f\u89c8\u5668\u8fd8\u6ca1\u6709\u652f\u6301\u6b64 CSS \u5c5e\u6027\uff0c\u56e0\u6b64\uff0c\u7c7b\u4f3c\u4e0a\u9762\u7684\u573a\u666f\u5728 Safari \u6d4f\u89c8\u5668\u4e0b\u7684\u4f53\u9a8c\u5c31\u5f88\u7cdf\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/2022-03-07_201313.png\" width=\"555\" height=\"232\" alt=\"overflow-anchor 2022\u5e74\u517c\u5bb9\u6027\"><\/p>\n<p>\u540c\u6837\uff0c\u5728 Safari \u6d4f\u89c8\u5668\u4e0b\uff0c\u5982\u679c\u5e0c\u671b\u6709 <code>overflow-anchor:auto<\/code> \u4e00\u6837\u7684\u6548\u679c\uff0c\u4f7f\u7528 JS \u6a21\u62df\uff0c\u522b\u65e0\u4ed6\u6cd5\u3002<\/p>\n<h3 id=\"scrollbar-width\">scrollbar-width<\/h3>\n<p><code>scrollbar-width<\/code> \u53ef\u4ee5\u7528\u6765\u81ea\u5b9a\u4e49\u6eda\u52a8\u6761\u7684\u5bbd\u5ea6\uff0c\u4e0d\u8fc7\u4e0d\u80fd\u6307\u5b9a\u5177\u4f53\u6570\u503c\uff0c\u53ea\u80fd\u662f\u6b63\u5e38\uff0817px\uff09\uff0c\u7ec6\uff088px\uff09\u548c\u6ca1\u6709\uff0c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>scrollbar-width: auto | thin | none;<\/pre>\n<p>\u4e3b\u8981\u9488\u5bf9 windows \u7cfb\u7edf\u4e0b\u7684 Firefox \u6d4f\u89c8\u5668\uff0c\u56e0\u4e3a Mac OS X \u6216iOS \u64cd\u4f5c\u7cfb\u7edf\u6eda\u52a8\u6761\u9ed8\u8ba4\u5c31\u4e0d\u5360\u636e\u5bbd\u5ea6\uff0c\u6ca1\u5fc5\u8981\u4f7f\u7528\u8fd9\u4e2a\uff0c\u800c Chrome \u6d4f\u89c8\u5668\u53ef\u4ee5\u4f7f\u7528 <code>-webkit-scrollbar<\/code> \u4f2a\u5143\u7d20\u81ea\u5b9a\u4e49\u6eda\u52a8\u6761\u7684\u5bbd\u5ea6\uff0c\u7528\u4e0d\u5230 <code>scrollbar-width<\/code>  \u8bbe\u7f6e\u3002<\/p>\n<p>\u5de7\u7684\u662f\u8fd9\u4e2a CSS \u5c5e\u6027\u4e5f\u5c31\u53ea\u6709 Firefox \u652f\u6301\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202201\/2022-01-11_233659.png\" width=\"554\" height=\"189\" alt=\"Firefox 64+\u652f\u6301\" class=\"alignnone size-medium\"><\/p>\n<h3 id=\"scrollbar-color\">scrollbar-color<\/h3>\n<p><code>scrollbar-color<\/code> \u53ef\u4ee5\u8bbe\u7f6e\u6eda\u52a8\u6761\u7684\u989c\u8272\uff0c\u548c <code>scrollbar-width<\/code> \u4e00\u6837\uff0c\u4ec5 Firefox \u6d4f\u89c8\u5668\u652f\u6301\uff0c\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>scrollbar-color: auto | \u6ed1\u6746\u989c\u8272 \u8f68\u9053\u989c\u8272;<\/pre>\n<p>\u548c <code>scrollbar-width<\/code> \u5c5e\u6027\u4e00\u8d77\uff0c\u586b\u8865\u4e86 Firefox \u6d4f\u89c8\u5668\u6eda\u52a8\u6761\u6837\u5f0f\u65e0\u6cd5\u81ea\u5b9a\u4e49\u7684\u7a7a\u767d\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>.container {\r\n    scrollbar-width: thin;\r\n    scrollbar-color: #0009 transparent;\r\n}<\/pre>\n<p>\u5c31\u4f1a\u6709\u4e0b\u9762\u8fd9\u6837\u7684\u9ed1\u6761\u6761\u6eda\u52a8\u6548\u679c\u4e86\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/2022-03-07_221408.png\" width=\"304\" height=\"152\" alt=\"\u6eda\u52a8\u6761\u6761\u6548\u679c\" class=\"alignnone size-medium\" \/><\/p>\n<h3 id=\"scrollbar-gutter\">scrollbar-gutter<\/h3>\n<p><code>scrollbar-gutter<\/code> \u53ef\u4ee5\u8ba9\u6eda\u52a8\u6761\u51fa\u73b0\u7684\u65f6\u5019\u5185\u5bb9\u4e0d\u6643\u52a8\u3002<\/p>\n<p>\u5b9e\u73b0\u539f\u7406\u662f\u628a\u6eda\u52a8\u6761\u7684\u4f4d\u7f6e\u63d0\u524d\u9884\u7559\u597d\uff08\u7a7a\u767d\uff09\uff0c\u8fd9\u6837\uff0c\u6eda\u52a8\u6761\u51fa\u73b0\u7684\u65f6\u5019\u5185\u5bb9\u5c31\u4e0d\u4f1a\u6643\u52a8\u4e86\uff0c\u793a\u610f\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202201\/2022-01-12_003333.png\" width=\"330\" height=\"342\" alt=\"stable\u6548\u679c\u622a\u56fe\" class=\"alignnone size-medium\"><\/p>\n<p>\u8be5\u5c5e\u6027\u4e4b\u524d\u6709\u4ecb\u7ecd\u8fc7\uff0c\u8be6\u89c1\u8fd9\u7bc7\u6587\u7ae0\uff1a\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2022\/01\/css-scrollbar-gutter\/\">\u8fd8\u6709\u5b8c\u6ca1\u5b8c\uff0c\u600e\u4e48\u53c8\u6765\u4e86\u4e2a scrollbar-gutter\uff1f<\/a>\u201d<\/p>\n<p>\u7531\u4e8e\u662f\u6e10\u8fdb\u589e\u5f3a\u5c5e\u6027\uff0c\u56e0\u4e3a\u53ef\u4ee5\u653e\u5fc3\u5927\u80c6\u4f7f\u7528\uff0c\u517c\u5bb9\u6027\u5982\u4e0b\uff0c\u9002\u5408\u684c\u9762\u7aef Web \u4ea7\u54c1\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/2022-03-07_202425.png\" width=\"554\" height=\"292\" alt=\"scrollbar-gutter 2022\u5e74\u517c\u5bb9\u6027\"><\/p>\n<h3 id=\"overflow-scrolling\">overflow-scrolling<\/h3>\n<p><code>-webkit-overflow-scrolling<\/code> \u662f\u4e00\u4e2a\u79c1\u6709\u5c5e\u6027\uff0c\u53ef\u4ee5\u8ba9 iOS \u4e0b\u6eda\u52a8\u6709\u56de\u5f39\u6548\u679c\uff0c\u4e0d\u8fc7\u6211\u60f3\u8bb2\u7684\u4e0d\u662f\u8fd9\u4e2a\uff0c\u800c\u662f\u53e6\u5916\u4e00\u4e2a\u53ef\u80fd\u6709\u4e9b\u4eba\u4e0d\u77e5\u9053\u7684\u4fe1\u606f\u3002<\/p>\n<p>\u90a3\u5c31\u662f iOS 13\u4e4b\u540e\uff0c\u4e0d\u9700\u8981\u518d\u8bbe\u7f6e <code>-webkit-over\ufb02ow-scrolling: touch<\/code> \u4e86\uff0c\u56e0\u4e3a\u6240\u6709\u53ef\u6eda\u52a8\u7684\u6846\u67b6\uff0c\u6216\u8005\u8bbe\u7f6e over\ufb02ow \u6eda\u52a8\u7684\u5143\u7d20\u9ed8\u8ba4\u90fd\u662f\u5f39\u6027\u6548\u679c\u4e86\u3002<\/p>\n<p>iOS 13\u7684\u66f4\u65b0\u65e5\u5fd7\u4e2d\u6709\u8fd9\u4e48\u4e00\u6bb5\u539f\u8bdd\uff1a<\/p>\n<blockquote><p><strong>New Features<\/strong><br \/>\n\u00b7 Added support for one-finger accelerated scrolling to all frames and overflow:scroll elements eliminating the need to set-webkit-overflow-scrolling: touch.<\/p><\/blockquote>\n<p>\u6240\u4ee5\uff0c\u6ca1\u6709\u4efb\u4f55\u7406\u7531\u518d\u53bb\u4f7f\u7528 <code>overflow-scrolling<\/code> \u5c5e\u6027\u4e86\uff0c\u8fd9\u662f\u4e2a\u53ea\u4f1a\u589e\u52a0\u9ebb\u70e6\u7684 CSS \u5c5e\u6027\uff0c\u548c\u5b83\u544a\u522b\u5427\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/2022-03-07_202926.png\" width=\"553\" height=\"306\" alt=\"overflow-scrolling\u517c\u5bb9\u6027\"><\/p>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u4e0e\u6eda\u52a8\u76f8\u5173\u7684 CSS \u5c5e\u6027\u8fd8\u6709\u4e00\u4e9b\uff0c\u4f8b\u5982 <code>overflow:clip<\/code>\uff0c<code>@scroll-timeline<\/code> \u89c4\u5219\u7b49\uff0c\u4e0d\u8fc7\u7531\u4e8e\u7f3a\u5c11\u72ec\u7acb\u6027\uff0c\u6216\u8005\u517c\u5bb9\u6027\u8fd8\u592a\u5dee\uff0c\u6240\u4ee5\u6ca1\u6709\u4ecb\u7ecd\u3002<\/p>\n<p>\u6240\u6709\u8fd9\u4e9b CSS \u5c5e\u6027\u90fd\u662f\u6e90\u81ea\u65e5\u5e38\u4ea4\u4e92\u4e2d\u7684\u7ec6\u5c0f\u7684\u4f53\u9a8c\u95ee\u9898\uff0c\u5b58\u5728\u5373\u6709\u9053\u7406\uff0c\u6ca1\u6709\u8fd9\u4e9b CSS \u5c5e\u6027\u597d\u50cf\u4e16\u754c\u4e5f\u80fd\u8fd0\u8f6c\uff0c\u90a3\u662f\u56e0\u4e3a\u8fd9\u4e9b\u5c5e\u6027\u4e0e\u529f\u80fd\u5173\u8054\u4e0d\u5927\uff0c\u800c\u662f\u4e0e\u7528\u6237\u4f53\u9a8c\u5bc6\u5207\u76f8\u5173\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u5982\u679c\u662f\u5173\u6ce8\u7528\u6237\u4f53\u9a8c\u7684\u524d\u7aef\uff0c\u8fd9\u4e9b CSS \u5c5e\u6027\u90fd\u662f\u6709\u5fc5\u8981\u4e86\u89e3\u4e0b\u7684\u3002<\/p>\n<p>\u597d\uff0c\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u5168\u90e8\u5185\u5bb9\uff0c\u5982\u679c\u60a8\u8fd8\u89c9\u5f97\u4e0d\u9519\uff0c\u6b22\u8fce\u70b9\u8d5e\uff0c\u6b22\u8fce<button onclick=\"shareWeixin.click()\" class=\"entry-share-btn\">\u5206\u4eab<\/button>\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/emtion\/emoji\/1f33b.svg\" width=\"20\" height=\"20\" align=\"absmiddle\"><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u6b22\u8fce\u5206\u4eab\uff0c\u52ff\u5168\u6587\u8f6c\u8f7d\uff0c\u5982\u679c\u5b9e\u5728\u559c\u6b22\uff0c\u53ef\u6536\u85cf\uff0c\u6c38\u4e0d\u8fc7\u671f\uff0c\u4e14\u4f1a\u53ca\u65f6\u66f4\u65b0\u77e5\u8bc6\u70b9\u53ca\u4fee\u6b63\u9519\u8bef\uff0c\u9605\u8bfb\u4f53\u9a8c\u4e5f\u66f4\u597d\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=10345\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=10345<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202203\/scroll-cover.jpg\" width=\"160\" height=\"98\" alt=\"\u6eda\u6eda\u5c01\u9762\u56fe\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>\u4ecb\u7ecd\u4e0e\u6eda\u52a8\u76f8\u5173\u76848\u4e2aCSS\u65b0\u7279\u6027\uff0c\u76f8\u4fe1\u91cc\u9762\u4e00\u5b9a\u6709\u5f88\u591a\u5c5e\u6027\u4f60\u5e76\u4e0d\u8ba4\u8bc6\uff0c\u662f\u7b2c\u4e00\u6b21\u89c1\uff0c\u8fd9\u4e9b\u5c5e\u6027\u975e\u5e38\u6709\u52a9\u4e8e\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1649,1535,1536,1327,1815,1817,1814],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/10345"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=10345"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/10345\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=10345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=10345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=10345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}