{"id":647,"date":"2017-10-19T13:18:00","date_gmt":"2017-10-19T04:18:00","guid":{"rendered":"http:\/\/www.takaya-com.jp\/archives\/?p=647"},"modified":"2017-10-19T13:18:00","modified_gmt":"2017-10-19T04:18:00","slug":"%e6%8c%87%e5%ae%9a%e3%82%b5%e3%82%a4%e3%82%ba%e3%81%be%e3%81%a7%e7%94%bb%e5%83%8f%e3%82%92%e6%8b%a1%e5%a4%a7%e7%b8%ae%e5%b0%8f%e3%81%99%e3%82%8b%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7","status":"publish","type":"post","link":"https:\/\/takaya-com.jp\/archives\/2017\/10\/%e6%8c%87%e5%ae%9a%e3%82%b5%e3%82%a4%e3%82%ba%e3%81%be%e3%81%a7%e7%94%bb%e5%83%8f%e3%82%92%e6%8b%a1%e5%a4%a7%e7%b8%ae%e5%b0%8f%e3%81%99%e3%82%8b%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7\/","title":{"rendered":"\u6307\u5b9a\u30b5\u30a4\u30ba\u307e\u3067\u753b\u50cf\u3092\u62e1\u5927\u7e2e\u5c0f\u3059\u308b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3"},"content":{"rendered":"<p><!-- \u672c\u6587 --><\/p>\n<p>\u6307\u5b9a\u30b5\u30a4\u30ba\u307e\u3067\u753b\u50cf\u3092\u62e1\u5927\u7e2e\u5c0f\u3059\u308b<strong>JavaScript<\/strong>\u306e\u7d39\u4ecb\u3067\u3059\u3002<br \/>\n<!--more--><\/p>\n<p>\u2193\u4ee5\u4e0b\u304c\u5b9f\u969b\u306e\u30bd\u30fc\u30b9\u30b5\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n<p>\u25bcJavaScript<\/p>\n<pre class=\"lang:js decode:true \" title=\"JavaScript\" >\r\nfunction expansionWidth( $target, $maxWidth ) {\r\n\r\n    disabledButtons( true );\r\n\r\n    var $intervalID = setInterval(\r\n        function(){\r\n            changeWidth()\r\n        },\r\n        1\r\n    );\r\n\r\n    function changeWidth() {\r\n        var $targetElement = document.getElementById( $target );\r\n\r\n        var $width = $targetElement.style.width;\r\n\r\n        $width = parseInt( $width.replace( 'px', '' ) );\r\n\r\n        if( $width < $maxWidth ){\r\n            $targetElement.style.width = ++$width + 'px';\r\n        }else{\r\n\r\n            clearInterval( $intervalID );\r\n\r\n            disabledButtons( false );\r\n        }\r\n    }\r\n}\r\n\r\nfunction reductionWidth( $target, $minWidth ) {\r\n\r\n    disabledButtons( true );\r\n\r\n    var $intervalID = setInterval(\r\n        function(){\r\n            changeWidth()\r\n        },\r\n        1\r\n    );\r\n\r\n    function changeWidth() {\r\n        var $targetElement = document.getElementById( $target );\r\n\r\n        var $width = $targetElement.style.width;\r\n\r\n        $width = parseInt( $width.replace( 'px', '' ) );\r\n\r\n        if( $width > $minWidth ){\r\n            $targetElement.style.width = --$width + 'px';\r\n        }else{\r\n\r\n            clearInterval( $intervalID );\r\n\r\n            disabledButtons( false );\r\n        }\r\n    }\r\n}\r\n\r\nfunction disabledButtons( $disabled ) {\r\n    $buttons = document.getElementById( \"sampleButtons\" ).getElementsByTagName( \"button\" );\r\n    for( var $i = 0; $i < $buttons.length; $i++ ) {\r\n        $buttons[$i].disabled = $disabled;\r\n    }\r\n}\r\n\r\n<\/pre>\n<pre class=\"lang:css decode:true \" title=\"CSS\" >\r\n\u25bcCSS\r\n<style type=\"text\/css\">\r\nmain{\r\n    text-align: center;\r\n}\r\n\r\np{\r\n    padding: 20px;\r\n}\r\n<\/pre>\n<pre class=\"lang:xhtml decode:true \" title=\"HTML\" >\r\n\u25bcHTML\r\n<main>\r\n    <p id=\"sampleButtons\">\r\n        <button onclick=\"expansionWidth( 'image', '400' );\">\u5e45\u3092400px\u306b\u62e1\u5927<\/button>\r\n        <button onclick=\"reductionWidth( 'image', '200' );\">\u5e45\u3092200px\u306b\u7e2e\u5c0f<\/button>\r\n    <\/p>\r\n    <img decoding=\"async\" id=\"image\" style=\"width: 150px;\" src=\"img\/1.jpg\">\r\n<\/main>\r\n<\/pre>\n<p>\u4eca\u56de\u3001\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u306e\u306f\u3001\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u306e\u300e\u30a2\u30eb\u30d5\u30a1\u30b7\u30b9 - alphasis.info -\u300f\u3055\u3093\u3067\u3059\u3002\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/alphasis.info\/\" target=\"_blank\">\u30a2\u30eb\u30d5\u30a1\u30b7\u30b9 - alphasis.info -<\/a><br \/>\n<a href=\"http:\/\/www.takaya-com.jp\/archives\/demo\/img_transform\" target=\"_blank\">\u30c7\u30e2\u30da\u30fc\u30b8\u306f\u3001\u3053\u3061\u3089<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6307\u5b9a\u30b5\u30a4\u30ba\u307e\u3067\u753b\u50cf\u3092\u62e1\u5927\u7e2e\u5c0f\u3059\u308bJavaScript\u306e\u7d39\u4ecb\u3067\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\/647"}],"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=647"}],"version-history":[{"count":4,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/647\/revisions"}],"predecessor-version":[{"id":651,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/647\/revisions\/651"}],"wp:attachment":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/media?parent=647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/categories?post=647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/tags?post=647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}