{"id":53225,"date":"2024-12-03T11:07:30","date_gmt":"2024-12-03T03:07:30","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53225\/"},"modified":"2024-12-03T11:07:30","modified_gmt":"2024-12-03T03:07:30","slug":"%e5%a6%82%e4%bd%95%e8%ae%a9%e6%bb%9a%e5%8a%a8%e6%9d%a1%e6%bb%9a%e5%8a%a8%e6%9b%b4%e5%8a%a0%e5%b9%b3%e6%bb%91%ef%bc%9f-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53225\/","title":{"rendered":"\u5982\u4f55\u8ba9\u6eda\u52a8\u6761\u6eda\u52a8\u66f4\u52a0\u5e73\u6ed1\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u8ba9\u6eda\u52a8\u6761\u6eda\u52a8\u66f4\u52a0\u5e73\u6ed1\uff1f<\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u8ba9\u6eda\u52a8\u6761\u6eda\u52a8\u66f4\u52a0\u5e73\u6ed1\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241128\/17327653456747e6a17ee34.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u8ba9\u6eda\u52a8\u6761\u6eda\u52a8\u66f4\u52a0\u5e73\u6ed1\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u8ba9\u6eda\u52a8\u6761\u6eda\u52a8\u66f4\u52a0\u5e73\u6ed1\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u6eda\u52a8\u6761\u6ed1\u52a8\u5e73\u6ed1\u5316<\/strong><\/p>\n<p>\u4f60\u60f3\u4e3a\u5143\u7d20\u6dfb\u52a0\u4e00\u4e2a\u52a8\u753b\u6548\u679c\uff0c\u4ee5\u5e73\u6ed1\u6eda\u52a8\u6761\u7684\u79fb\u52a8\u3002\u4e3a\u5b9e\u73b0\u8fd9\u4e00\u70b9\uff0c\u53ef\u5229\u7528 scroll-behavior \u5c5e\u6027\u3002<\/p>\n<p><strong>\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u5728 css \u4e2d\uff0c\u4e3a\u6eda\u52a8\u5bb9\u5668\u8bbe\u7f6e scroll-behavior \u5c5e\u6027\u4e3a smooth\uff1a<\/p>\n<pre>#container {\n  scroll-behavior: smooth;\n}<\/pre>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<p>\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528 scroll-behavior \u5c5e\u6027\u5b9e\u73b0\u6eda\u52a8\u6761\u5e73\u6ed1\u6eda\u52a8\uff1a<\/p>\n<pre>&lt;div id=\"container\"&gt;\n  &lt;div id=\"content\"&gt;click the button to slide right!&lt;\/div&gt;\n&lt;\/div&gt;\n\n&lt;button id=\"slide\" type=\"button\"&gt;slide right&lt;\/button&gt;<\/pre>\n<pre>#container {\n  width: 100px;\n  height: 100px;\n  border: 1px solid #ccc;\n  overflow-x: scroll;\n  scroll-behavior: smooth;\n}\n\n#content {\n  width: 250px;\n  background-color: #ccc;\n}<\/pre>\n<pre>const button = document.getElementById(\"slide\");\n\nbutton.onclick = function () {\n  document.getElementById(\"container\").scrollLeft += 20;\n};<\/pre>\n<p>\u901a\u8fc7\u8bbe\u7f6e scroll-behavior \u4e3a smooth\uff0c\u5f53\u4f7f\u7528 javascript \u66f4\u6539\u5143\u7d20\u7684 scrollleft \u503c\u65f6\uff0c\u6eda\u52a8\u5c06\u5e73\u6ed1\u8fdb\u884c\uff0c\u4ece\u800c\u6d88\u9664\u751f\u786c\u7684\u79fb\u52a8\u6548\u679c\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300a\u5982\u4f55\u8ba9\u6eda\u52a8\u6761\u6eda\u52a8\u66f4\u52a0\u5e73\u6ed1\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   win7\u7535\u8111\u53ea\u80fd\u4f7f\u7528\u6709\u7ebf\u7f51\u7edc\u65e0\u6cd5\u4f7f\u7528wifi\u600e\u4e48\u89e3\u51b3\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u8ba9\u6eda\u52a8\u6761\u6eda\u52a8\u66f4\u52a0\u5e73\u6ed1\uff1f \u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u8ba9\u6eda\u52a8\u6761\u6eda\u52a8\u66f4\u52a0\u5e73\u6ed1\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002 \u6eda\u52a8\u6761\u6ed1\u52a8\u5e73\u6ed1\u5316 \u4f60\u60f3\u4e3a\u5143\u7d20\u6dfb\u52a0\u4e00\u4e2a\u52a8\u753b\u6548\u679c\uff0c\u4ee5\u5e73\u6ed1\u6eda\u52a8\u6761\u7684\u79fb\u52a8\u3002\u4e3a\u5b9e\u73b0\u8fd9\u4e00\u70b9\uff0c\u53ef\u5229\u7528 scroll-behavior \u5c5e\u6027\u3002 \u65b9\u6cd5\uff1a \u5728 css \u4e2d\uff0c\u4e3a\u6eda\u52a8\u5bb9\u5668\u8bbe\u7f6e scroll-behavior \u5c5e\u6027\u4e3a smooth\uff1a #container { scroll-behavior: smooth; } \u793a\u4f8b\uff1a \u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u4f7f\u7528 scroll-behavior \u5c5e\u6027\u5b9e\u73b0\u6eda\u52a8\u6761\u5e73\u6ed1\u6eda\u52a8\uff1a &lt;div id=&#8221;container&#8221;&gt; &lt;div id=&#8221;content&#8221;&gt;click the button to slide right!&lt;\/div&gt; &lt;\/div&gt; &lt;button id=&#8221;slide&#8221; type=&#8221;button&#8221;&gt;slide right&lt;\/button&gt; #container { width: 100px; height: 100px; border: 1px solid #ccc; overflow-x: scroll; scroll-behavior: smooth; } #content { width: 250px; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53225","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53225"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53225\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}