{"id":452,"date":"2016-03-22T16:12:33","date_gmt":"2016-03-22T07:12:33","guid":{"rendered":"http:\/\/www.takaya-com.jp\/archives\/?p=452"},"modified":"2016-03-23T11:52:30","modified_gmt":"2016-03-23T02:52:30","slug":"scaleslideshow","status":"publish","type":"post","link":"https:\/\/takaya-com.jp\/archives\/2016\/03\/scaleslideshow\/","title":{"rendered":"jQuery\u3067\u3001\u4e2d\u592e\u306e\u753b\u50cf\u304c\u62e1\u5927\u8868\u793a\u3059\u308b\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u3092\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f"},"content":{"rendered":"<p><!-- \u672c\u6587 --><\/p>\n<p>\u30b9\u30e9\u30a4\u30c9\u3059\u308b\u3068\u3001\u4e2d\u592e\u306e\u753b\u50cf\u304c\u62e1\u5927\u8868\u793a\u3059\u308b\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u3092jQuery\u3067\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30b9\u30e9\u30a4\u30c9\u3057\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u2193\u4ee5\u4e0b\u304c\u5b9f\u969b\u306e\u30bd\u30fc\u30b9\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" title=\"\u25bcJavaScript\" >&lt;script&gt;\r\n$(function () {\r\n\tvar x = 320, \/\/\u753b\u50cf\u306e\u6a2a\u5e45\r\n\t\tzoom = 1.2, \/\/\u62e1\u5927\u306e\u500d\u7387\r\n\t\timgLength = $(\"ul li\").length,\r\n\t\thantei = true;\r\n\r\n\t$(\"ul\").css({\"width\": ((x * imgLength) + (960 - (x * 2))) + \"px\",\"margin-left\": \"-\" + x + \"px\"});\r\n\t$(\"ul li\").css(\"width\", x + \"px\");\r\n\r\n\t$(\"ul li:eq(3)\").css({\r\n\t\t\"margin-left\": (960 - (x * 2)) + \"px\"\r\n\t});\r\n\t$(\"ul li:eq(2)\").addClass(\"mainImg\").css({\r\n\t\t\"left\": \"50%\",\r\n\t\t\"width\": (x * zoom) + \"px\",\r\n\t\t\"height\": \"auto\",\r\n\t\t\"margin-left\": \"-\" + ((x * zoom) \/ 2) + \"px\"\r\n\t});\r\n\t$(\"ul\").click(function () {\r\n\t\tif (hantei) {\r\n\t\t\thantei = false;\r\n\t\t\t$(\"ul li:eq(3)\").css({\r\n\t\t\t\t\"margin-left\": (x \/ 2) + \"px\"\r\n\t\t\t});\r\n\t\t\t$(\"ul li:eq(4)\").css({\r\n\t\t\t\t\"margin-left\": (960 - (x * 2)) + x + \"px\"\r\n\t\t\t});\r\n\t\t\t$(\"ul\").animate({\r\n\t\t\t\t\"margin-left\": \"-\" + x * 2 + \"px\"\r\n\t\t\t}, 1000, function () {\r\n\t\t\t\t$(\"ul li:eq(0)\").appendTo(\"ul\");\r\n\t\t\t\t$(\"ul\").css(\"margin-left\", \"-\" + x + \"px\");\r\n\t\t\t});\r\n\t\t\t$(\"ul li:eq(2)\").animate({\r\n\t\t\t\t\"margin-left\": \"0\",\r\n\t\t\t\t\"width\": x + \"px\",\r\n\t\t\t\t\"height\": \"auto\",\r\n\t\t\t\t\"left\": \"0\"\r\n\t\t\t}, 1000).removeClass(\"mainImg\");\r\n\t\t\t$(\"ul li:eq(3)\").addClass(\"mainImg\").css({\"left\": \"50%\", \"margin-left\": (960 - (x * 2)) \/ 2 + \"px\"}).animate({\r\n\t\t\t\t\"width\": (x * zoom) + \"px\",\r\n\t\t\t\t\"height\": \"auto\",\r\n\t\t\t\t\"margin-left\": \"-\" + ((x * zoom) \/ 2) + \"px\"\r\n\t\t\t}, 1000, function () {\r\n\t\t\t\t$(\"ul li:eq(3)\").css({\r\n\t\t\t\t\t\"margin-left\": (960 - (x * 2)) + \"px\"\r\n\t\t\t\t});\r\n\t\t\t\thantei = true;\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t});\r\n});\r\n&lt;\/script&gt;<\/pre>\n<pre class=\"lang:css decode:true \" title=\"\u25bcCSS\" >&lt;style&gt;\r\n\t\t* {\r\n\t\t\tmargin: 0;\r\n\t\t\tpadding: 0;\r\n\t\t\tborder: 0;\r\n\t\t}\r\n\r\n\t\t#main {\r\n\t\t\tposition: relative;\r\n\t\t\twidth: 960px;\r\n\t\t\theight: 500px;\r\n\t\t\tborder: 1px solid #000;\r\n\t\t\tmargin: 0 auto;\r\n\t\t\toverflow: hidden;\r\n\t\t}\r\n\r\n\t\t#main ul li {\r\n\t\t\tdisplay: inline-block;\r\n\t\t\twidth: 320px;\r\n\t\t\theight: auto;\r\n\t\t\tbox-shadow: 0 10px 20px 0 rgba(0, 0, 0, 0.5);\r\n\t\t}\r\n\r\n\t\t#main ul li img {\r\n\t\t\twidth: 100%;\r\n\t\t\theight: auto;\r\n\t\t\tvertical-align: bottom;\r\n\t\t}\r\n\r\n\t\t.mainImg,\r\n\t\t#main ul li:nth-child(3) {\r\n\t\t\tposition: absolute;\r\n\t\t}\r\n&lt;\/style&gt;<\/pre>\n<pre class=\"lang:xhtml decode:true \" title=\"\u25bcHTML\" >&lt;div id=\"main\"&gt;\r\n&lt;ul&gt;&lt;!--\r\n--&gt;&lt;li&gt;&lt;img src=\"image\/topimg1.jpg\"&gt;&lt;\/li&gt;&lt;!--\r\n--&gt;&lt;li&gt;&lt;img src=\"image\/topimg2.jpg\"&gt;&lt;\/li&gt;&lt;!--\r\n--&gt;&lt;li&gt;&lt;img src=\"image\/topimg3.jpg\"&gt;&lt;\/li&gt;&lt;!--\r\n--&gt;&lt;li&gt;&lt;img src=\"image\/topimg4.jpg\"&gt;&lt;\/li&gt;&lt;!--\r\n--&gt;&lt;li&gt;&lt;img src=\"image\/topimg5.jpg\"&gt;&lt;\/li&gt;&lt;!--\r\n--&gt;&lt;\/ul&gt;\r\n&lt;\/div&gt;<\/pre>\n<p><a href=\"http:\/\/www.takaya-com.jp\/archives\/demo\/scaleslideshow\/\" target=\"_blank\">\u30c7\u30e2\u30da\u30fc\u30b8\u306f\u3001\u3053\u3061\u3089<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b9\u30e9\u30a4\u30c9\u3059\u308b\u3068\u3001\u4e2d\u592e\u306e\u753b\u50cf\u304c\u62e1\u5927\u8868\u793a\u3059\u308b\u30b9\u30e9\u30a4\u30c9\u30b7\u30e7\u30fc\u3092jQuery\u3067\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002 \u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u30b9\u30e9\u30a4\u30c9\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/452"}],"collection":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/comments?post=452"}],"version-history":[{"count":6,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/452\/revisions"}],"predecessor-version":[{"id":463,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/452\/revisions\/463"}],"wp:attachment":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/media?parent=452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/categories?post=452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/tags?post=452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}