{"id":31516,"date":"2024-11-25T09:12:11","date_gmt":"2024-11-25T01:12:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31516\/"},"modified":"2024-11-25T09:12:11","modified_gmt":"2024-11-25T01:12:11","slug":"jquery%e5%ae%9e%e7%8e%b0%e9%bc%a0%e6%a0%87%e7%bb%91%e5%ae%9a%e4%ba%8b%e4%bb%b6%e5%9b%be%e7%89%87%e6%94%be%e5%a4%a7%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31516\/","title":{"rendered":"jQuery\u5b9e\u73b0\u9f20\u6807\u7ed1\u5b9a\u4e8b\u4ef6\u56fe\u7247\u653e\u5927\u529f\u80fd"},"content":{"rendered":"<p style=\"text-align: left\">\u8fd9\u6b21\u7ed9\u5927\u5bb6\u5e26\u6765jQuery\u5b9e\u73b0\u9f20\u6807\u7ed1\u5b9a\u4e8b\u4ef6\u56fe\u7247\u653e\u5927\u529f\u80fd\uff0cjQuery\u5b9e\u73b0\u9f20\u6807\u7ed1\u5b9a\u4e8b\u4ef6\u56fe\u7247\u653e\u5927\u529f\u80fd\u7684\u6709\u54ea\u4e9b\uff0c\u4e0b\u9762\u5c31\u662f\u5b9e\u6218\u6848\u4f8b\uff0c\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u3002<\/p>\n<pre>&lt;!doctype html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=\"utf-8\"&gt;\r\n&lt;title&gt;jQuery\u56fe\u7247\u53d8\u6362&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;style type=\"text\/css\"&gt;\r\n .show{width:330px; height:auto; margin:50px auto; background:#eee}\r\n .item{background:#fff; width:300px; height:auto; float:left; margin:15px;}\r\n p{ padding:15px; color:#ff6600}\r\n .big-photo img{ width:300px; height:300px; border:1px solid #e0e0e0}\r\n .des-small img{ width:30px; height:30px;border:1px solid #e0e0e0; }\r\n .des-small img:hover{ border:1px solid #ff6600}\r\n .clear{clear:both}\r\n&lt;\/style&gt;\r\n&lt;script src=\"http:\/\/libs.baidu.com\/jquery\/2.0.0\/jquery.min.js\"&gt;&lt;\/script&gt;\r\n&lt;script type=\"text\/javascript\"&gt;\r\n $(function() {\r\n  \/** \u66f4\u6362\u5c0f\u56fe\u7247 *\/\r\n  $(\".item a\").hover(function(){\r\n   changeImg($(this))\r\n  }); \r\n });\r\n function changeImg(obj){\r\n  if(obj.find(\"img\").attr(\"alt\")==\"small\"){\r\n   var temp_big_src = obj.siblings('a').find('img[alt=big]').attr('src');\r\n   var temp_big_url = obj.siblings('a[class=big-photo]').attr('href');\r\n   var temp_small_src = obj.find('img').attr('src');\r\n   var temp_small_url = obj.attr('href');\r\n   obj.siblings('a').find('img[alt=big]').attr('src',temp_small_src);\r\n  }\r\n }\r\n&lt;\/script&gt;\r\n&lt;body&gt;\r\n &lt;p class=\"show\"&gt;\r\n  &lt;p&gt;jquery\u5b9e\u73b0\u9f20\u6807\u79fb\u52a8\/\u79fb\u8fc7\u5230\u5546\u54c1\u5c0f\u56fe\u7247\u4e0a\u65f6\u66ff\u6362\u6389\u5927\u56fe\u7247\u4e0a\u7684\u56fe\u7247&lt;\/p&gt;\r\n  &lt;p class=\"item\"&gt;\r\n   &lt;a class=\"big-photo\"&gt;\r\n    &lt;img src=\"WR_00001.jpg\" alt=\"big\"\/&gt;\r\n   &lt;\/a&gt;\r\n   &lt;a class=\"des-small\"&gt;\r\n    &lt;img src=\"WR_00002.jpg\" alt=\"small\"\/&gt;\r\n   &lt;\/a&gt;\r\n   &lt;a class=\"des-small\"&gt;\r\n    &lt;img src=\"WR_00003.jpg\" alt=\"small\"\/&gt;\r\n   &lt;\/a&gt;\r\n   &lt;a class=\"des-small\"&gt;\r\n    &lt;img src=\"WR_00004.jpg\" alt=\"small\"\/&gt;\r\n   &lt;\/a&gt;\r\n  &lt;\/p&gt;\r\n  &lt;p class=\"clear\"&gt;&lt;\/p&gt;\r\n &lt;\/p&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u76f8\u4fe1\u770b\u4e86\u672c\u6587\u6848\u4f8b\u4f60\u5df2\u7ecf\u638c\u63e1\u4e86\u65b9\u6cd5\uff0c\u66f4\u591a\u7cbe\u5f69\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n<p>\u63a8\u8350\u9605\u8bfb\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjQuery\u5b9e\u73b0\u9f20\u6807\u7ed1\u5b9a\u4e8b\u4ef6\u56fe\u7247\u653e\u5927\u529f\u80fd\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>\u8fd9\u6b21\u7ed9\u5927\u5bb6\u5e26\u6765jQuery\u5b9e\u73b0\u9f20\u6807\u7ed1\u5b9a\u4e8b\u4ef6\u56fe\u7247\u653e\u5927\u529f\u80fd\uff0cjQuery\u5b9e\u73b0\u9f20\u6807\u7ed1\u5b9a\u4e8b\u4ef6\u56fe\u7247\u653e\u5927\u529f\u80fd\u7684\u6709\u54ea\u4e9b\uff0c\u4e0b\u9762\u5c31\u662f\u5b9e\u6218\u6848\u4f8b\uff0c\u4e00\u8d77\u6765\u770b\u4e00\u4e0b\u3002 &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=&#8221;utf-8&#8243;&gt; &lt;title&gt;jQuery\u56fe\u7247\u53d8\u6362&lt;\/title&gt; &lt;\/head&gt; &lt;style type=&#8221;text\/css&#8221;&gt; .show{width:330px; height:auto; margin:50px auto; background:#eee} .item{background:#fff; width:300px; height:auto; float:left; margin:15px;} p{ padding:15px; color:#ff6600} .big-photo img{ width:300px; height:300px; border:1px solid #e0e0e0} .des-small img{ width:30px; height:30px;border:1px solid #e0e0e0; } .des-small img:hover{ border:1px solid #ff6600} .clear{clear:both} &lt;\/style&gt; &lt;script src=&#8221;http:\/\/libs.baidu.com\/jquery\/2.0.0\/jquery.min.js&#8221;&gt;&lt;\/script&gt; &lt;script type=&#8221;text\/javascript&#8221;&gt; $(function() { \/** \u66f4\u6362\u5c0f\u56fe\u7247 *\/ $(&#8220;.item [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-31516","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31516","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=31516"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31516\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}