{"id":27195,"date":"2024-11-24T13:10:59","date_gmt":"2024-11-24T05:10:59","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27195\/"},"modified":"2024-11-24T13:10:59","modified_gmt":"2024-11-24T05:10:59","slug":"%e5%a6%82%e4%bd%95%e7%a6%81%e7%94%a8-html-%e9%a1%b5%e9%9d%a2%e4%b8%ad%e7%9a%84-ctrl%e6%bb%9a%e8%bd%ae%e7%bc%a9%e6%94%be%e4%ba%8b%e4%bb%b6%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27195\/","title":{"rendered":"\u5982\u4f55\u7981\u7528 HTML \u9875\u9762\u4e2d\u7684 Ctrl+\u6eda\u8f6e\u7f29\u653e\u4e8b\u4ef6\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173120855435591.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u7981\u7528 HTML \u9875\u9762\u4e2d\u7684 Ctrl+\u6eda\u8f6e\u7f29\u653e\u4e8b\u4ef6\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u7981\u7528 HTML \u9875\u9762\u4e2d\u7684 Ctrl+\u6eda\u8f6e\u7f29\u653e\u4e8b\u4ef6\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5728 html \u4e2d\u7981\u7528 ctrl+\u6eda\u8f6e\u7f29\u653e\u4e8b\u4ef6<\/strong><\/p>\n<p>\u5728 HTML \u9875\u9762\u4e2d\uff0c\u5f53\u7528\u6237\u6309\u4f4f Ctrl \u952e\u5e76\u6eda\u52a8\u9f20\u6807\u6eda\u8f6e\u65f6\uff0c\u6d4f\u89c8\u5668\u901a\u5e38\u4f1a\u653e\u5927\u6216\u7f29\u5c0f\u9875\u9762\u3002\u4f46\u6709\u65f6\u6211\u4eec\u9700\u8981\u7981\u7528\u6b64\u884c\u4e3a\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u7981\u7528 Ctrl+\u6eda\u8f6e\u7f29\u653e\u4e8b\u4ef6\u3002<\/p>\n<p><strong>PC \u7aef\u539f\u751f\u7684\u65b9\u6cd5<\/strong><\/p>\n<p>\u4f7f\u7528 JavaScript \u4ee3\u7801\u76d1\u542c mousewheel \u548c keydown \u4e8b\u4ef6\uff0c\u5728\u5176\u4e2d\u963b\u6b62\u7f29\u653e\u4e8b\u4ef6\uff1a<\/p>\n<pre>document.addEventListener('mousewheel', function (e) {\n  e = e || window.event;\n  if ((e.wheelDelta &amp;&amp; event.ctrlKey) || e.detail) {\n    event.preventDefault();\n  }\n}, { capture: false, passive: false});\ndocument.addEventListener('keydown', function (event) {\n  if ((event.ctrlKey === true || event.metaKey === true)\n    &amp;&amp; (event.keyCode === 61 || event.keyCode === 107\n      || event.keyCode === 173 || event.keyCode === 109\n      || event.keyCode === 187 || event.keyCode === 189)) {\n    event.preventDefault();\n  }\n}, false);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>Vue \u9875\u9762\u4e2d\u7684\u5b9e\u73b0<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u5728 Vue \u9875\u9762\u4e2d\uff0c\u53ef\u4ee5\u5728 mounted \u94a9\u5b50\u4e2d\u76d1\u542c\u7a97\u53e3\u7f29\u653e\u4e8b\u4ef6\uff0c\u5e76\u5728\u56de\u8c03\u51fd\u6570\u4e2d\u8c03\u6574\u7a97\u53e3\u7f29\u653e\uff1a<\/p>\n<pre>mounted () {\n  this.keepRatio()\n  window.addEventListener('resize', () =&gt; {\/\/\u76d1\u542c\u7a97\u53e3\u7f29\u653e\n   this.keepRatio()\n  });\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728 methods \u4e2d\u5b9a\u4e49 keepRatio \u65b9\u6cd5\uff1a<\/p>\n<pre>methods: {\n  keepRatio () {\n    \/\/ \u83b7\u53d6\u7f29\u653e\u6bd4\u4f8b\n    \/\/ ...\n\n    \/\/ \u5c06\u7f29\u653e\u6bd4\u4f8b\u5e94\u7528\u5230 body \u5143\u7d20\n    document.body.style.zoom = 1 \/ this.ratio;\n  }\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u7981\u7528 HTML \u9875\u9762\u4e2d\u7684 Ctrl+\u6eda\u8f6e\u7f29\u653e\u4e8b\u4ef6\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 html \u4e2d\u7981\u7528 ctrl+\u6eda\u8f6e\u7f29\u653e\u4e8b\u4ef6 \u5728 HTML \u9875\u9762\u4e2d\uff0c\u5f53\u7528\u6237\u6309\u4f4f Ctrl \u952e\u5e76\u6eda\u52a8\u9f20\u6807\u6eda\u8f6e\u65f6\uff0c\u6d4f\u89c8\u5668\u901a\u5e38\u4f1a\u653e\u5927\u6216\u7f29\u5c0f\u9875\u9762\u3002\u4f46\u6709\u65f6\u6211\u4eec\u9700\u8981\u7981\u7528\u6b64\u884c\u4e3a\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u7981\u7528 Ctrl+\u6eda\u8f6e\u7f29\u653e\u4e8b\u4ef6\u3002 PC \u7aef\u539f\u751f\u7684\u65b9\u6cd5 \u4f7f\u7528 JavaScript \u4ee3\u7801\u76d1\u542c mousewheel \u548c keydown \u4e8b\u4ef6\uff0c\u5728\u5176\u4e2d\u963b\u6b62\u7f29\u653e\u4e8b\u4ef6\uff1a document.addEventListener(&#8216;mousewheel&#8217;, function (e) { e = e || window.event; if ((e.wheelDelta &amp;&amp; event.ctrlKey) || e.detail) { event.preventDefault(); } }, { capture: false, passive: false}); document.addEventListener(&#8216;keydown&#8217;, function (event) { if ((event.ctrlKey === true || event.metaKey === true) [&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-27195","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27195","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=27195"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27195\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}