{"id":2850,"date":"2024-11-10T15:36:29","date_gmt":"2024-11-10T07:36:29","guid":{"rendered":"https:\/\/fwq.ai\/blog\/2850\/"},"modified":"2024-11-10T15:36:29","modified_gmt":"2024-11-10T07:36:29","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e9%bc%a0%e6%a0%87%e6%82%ac%e6%b5%ae%e6%97%b6%e5%87%ba%e7%8e%b0%e7%9a%84-dom-%e5%85%83%e7%b4%a0%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/2850\/","title":{"rendered":"\u5982\u4f55\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u51fa\u73b0\u7684 DOM \u5143\u7d20\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173089440687860.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u51fa\u73b0\u7684 DOM \u5143\u7d20\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u51fa\u73b0\u7684 DOM \u5143\u7d20\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u624d\u51fa\u73b0\u7684 DOM \u5143\u7d20<\/strong><\/p>\n<p>\u5728\u7f51\u9875\u8c03\u8bd5\u4e2d\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u624d\u51fa\u73b0\u7684 DOM \u5143\u7d20\u3002\u8fd9\u79cd\u60c5\u51b5\u901a\u5e38\u6709\u4e24\u79cd\u539f\u56e0\uff1a<\/p>\n<p><strong>1. CSS \u63a7\u5236<\/strong><\/p>\n<p>\u7531 CSS \u63a7\u5236\u7684\u60ac\u6d6e\u5143\u7d20\u53ef\u4ee5\u901a\u8fc7\u5f3a\u5236\u6253\u5f00\u5176 :hover \u4f2a\u7c7b\u6765\u67e5\u770b\u3002\u4f8b\u5982\uff0c\u5728 Firefox \u6d4f\u89c8\u5668\u4e2d\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u53f3\u952e\u5355\u51fb\u60ac\u6d6e\u5143\u7d20\u5e76\u9009\u62e9\u201c\u68c0\u67e5\u5143\u7d20\u201d\u3002<\/li>\n<li>\u5728\u5143\u7d20\u5c5e\u6027\u9762\u677f\u4e2d\uff0c\u627e\u5230 :hover \u4f2a\u7c7b\u3002<\/li>\n<li>\u5c06\u5176\u524d\u9762\u7684\u590d\u9009\u6846\u9009\u4e2d\uff0c\u5f3a\u5236\u6253\u5f00\u8be5\u4f2a\u7c7b\u3002<\/li>\n<\/ol>\n<p><strong>2. JS \u63a7\u5236<\/strong><\/p>\n<p>\u7531 JS \u63a7\u5236\u7684\u60ac\u6d6e\u5143\u7d20\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u67e5\u770b\uff1a<\/p>\n<ol>\n<li>\u5c06\u5f00\u53d1\u8005\u5de5\u5177\u5207\u6362\u4e3a\u72ec\u7acb\u7a97\u53e3\u6a21\u5f0f\u3002<\/li>\n<li>\u9009\u62e9\u60ac\u6d6e\u5143\u7d20\u7684\u4e0a\u7ea7\u5143\u7d20\u3002<\/li>\n<li>\u9f20\u6807\u60ac\u6d6e\u5728\u60ac\u6d6e\u5143\u7d20\u4e0a\uff0c\u3092\u62bc\u6309Tab \u952e\u5373\u53ef\u9009\u4e2d\u65b0\u51fa\u73b0\u7684\u5143\u7d20\u3002<\/li>\n<\/ol>\n<p>\u4f8b\u5982\uff0c\u5728\u601d\u5426\u7f51\u7ad9\u7684\u6309\u94ae tooltip \u4e2d\uff0c\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u53ef\u4ee5\u9009\u4e2d tooltip \u5143\u7d20\u5e76\u5bf9\u5176\u8fdb\u884c\u68c0\u67e5\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u51fa\u73b0\u7684 DOM \u5143\u7d20\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>\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u624d\u51fa\u73b0\u7684 DOM \u5143\u7d20 \u5728\u7f51\u9875\u8c03\u8bd5\u4e2d\uff0c\u6709\u65f6\u6211\u4eec\u9700\u8981\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u624d\u51fa\u73b0\u7684 DOM \u5143\u7d20\u3002\u8fd9\u79cd\u60c5\u51b5\u901a\u5e38\u6709\u4e24\u79cd\u539f\u56e0\uff1a 1. CSS \u63a7\u5236 \u7531 CSS \u63a7\u5236\u7684\u60ac\u6d6e\u5143\u7d20\u53ef\u4ee5\u901a\u8fc7\u5f3a\u5236\u6253\u5f00\u5176 :hover \u4f2a\u7c7b\u6765\u67e5\u770b\u3002\u4f8b\u5982\uff0c\u5728 Firefox \u6d4f\u89c8\u5668\u4e2d\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a \u53f3\u952e\u5355\u51fb\u60ac\u6d6e\u5143\u7d20\u5e76\u9009\u62e9\u201c\u68c0\u67e5\u5143\u7d20\u201d\u3002 \u5728\u5143\u7d20\u5c5e\u6027\u9762\u677f\u4e2d\uff0c\u627e\u5230 :hover \u4f2a\u7c7b\u3002 \u5c06\u5176\u524d\u9762\u7684\u590d\u9009\u6846\u9009\u4e2d\uff0c\u5f3a\u5236\u6253\u5f00\u8be5\u4f2a\u7c7b\u3002 2. JS \u63a7\u5236 \u7531 JS \u63a7\u5236\u7684\u60ac\u6d6e\u5143\u7d20\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u67e5\u770b\uff1a \u5c06\u5f00\u53d1\u8005\u5de5\u5177\u5207\u6362\u4e3a\u72ec\u7acb\u7a97\u53e3\u6a21\u5f0f\u3002 \u9009\u62e9\u60ac\u6d6e\u5143\u7d20\u7684\u4e0a\u7ea7\u5143\u7d20\u3002 \u9f20\u6807\u60ac\u6d6e\u5728\u60ac\u6d6e\u5143\u7d20\u4e0a\uff0c\u3092\u62bc\u6309Tab \u952e\u5373\u53ef\u9009\u4e2d\u65b0\u51fa\u73b0\u7684\u5143\u7d20\u3002 \u4f8b\u5982\uff0c\u5728\u601d\u5426\u7f51\u7ad9\u7684\u6309\u94ae tooltip \u4e2d\uff0c\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u53ef\u4ee5\u9009\u4e2d tooltip \u5143\u7d20\u5e76\u5bf9\u5176\u8fdb\u884c\u68c0\u67e5\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u67e5\u770b\u9f20\u6807\u60ac\u6d6e\u65f6\u51fa\u73b0\u7684 DOM \u5143\u7d20\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-2850","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2850","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=2850"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2850\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=2850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=2850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=2850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}