{"id":1081,"date":"2015-02-27T23:51:13","date_gmt":"2015-02-27T14:51:13","guid":{"rendered":"http:\/\/www.sriproot.net\/blog\/?p=1081"},"modified":"2015-02-28T00:51:32","modified_gmt":"2015-02-27T15:51:32","slug":"font-size-change-btn","status":"publish","type":"post","link":"https:\/\/www.sriproot.net\/blog\/font-size-change-btn-1081","title":{"rendered":"\u4eca\u66f4\u3060\u3051\u3069font-size\u3092\u62e1\u5927\u3001\u7e2e\u5c0f\u3055\u305b\u308b\u30dc\u30bf\u30f3\u4f5c\u3063\u305f"},"content":{"rendered":"<p>2\u6708\u3082\u3082\u3046\u304a\u3057\u307e\u3044\u3067\u3059\u306d\u3002<br \/>\n\u3082\u30461\u5e74\u306e6\u5206\u306e1\u304c\u7d42\u4e86\u3067\u3059\u3088\u3002\u9a5a\u304d\u3067\u3059\u3002<\/p>\n<p>\u3055\u3066\u3001\u4e00\u6614\u524d\u306b\u3088\u304f\u898b\u305f\u3088\u3046\u306a\u300c\u6587\u5b57\u30b5\u30a4\u30ba\u3092\u5909\u3048\u308bJavascript\u300d\u899a\u3048\u3066\u307e\u3059\u304b\uff1f<br \/>\n\u300c\u5927\u300d\u300c\u4e2d\u300d\u300c\u5c0f\u300d\u3068\u30dc\u30bf\u30f3\u304c\u3042\u3063\u3066\u3001\u305d\u308c\u3092\u62bc\u3059\u3053\u3068\u3067\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u30dc\u30bf\u30f3\u304c\u5927\u304d\u304f\u306a\u308b\u3084\u3064\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u300c\u4e00\u6614\u524d\u306b\u898b\u305f\u3088\u3046\u306a\u300d\u3068\u8a00\u3063\u3066\u304a\u304d\u306a\u304c\u3089\u3001\u5148\u65e5\u305d\u308c\u3092\u3064\u304f\u308a\u307e\u3057\u305f\u306e\u3067\u3001\u899a\u3048\u66f8\u304d\u7a0b\u5ea6\u306b\u6b8b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>\u76ee\u6b21<\/h2>\n<ol>\n<li><a href=\"#step1\">\u51fa\u6765\u4e0a\u304c\u308a<\/a><\/li>\n<li><a href=\"#step2\">HTML\u3068css\u3068jQuery<\/a>\n<ol>\n<li><a href=\"#step2-1\">HTML<\/a><\/li>\n<li><a href=\"#step2-2\">css<\/a><\/li>\n<li><a href=\"#step2-3\">Javascript<\/a><\/li>\n<\/ol>\n<\/li>\n<li><a href=\"#step3\">jquery.cookie.js<\/a><\/li>\n<li><a href=\"#step4\">\u307e\u3068\u3081<\/a><\/li>\n<\/ol>\n<h2 id=\"step1\">\u51fa\u6765\u4e0a\u304c\u308a<\/h2>\n<p>\u3082\u3046\u3055\u3063\u3055\u3068\u5b8c\u6210\u54c1\u3092\u898b\u305f\u307b\u3046\u304c\u3044\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.sriproot.net\/blog\/sample-code\/font-size-change\" target=\"_blank\">jQuery\u3092\u4f7f\u3063\u305f\u6587\u5b57\u30b5\u30a4\u30ba\u306e\u5909\u66f4\u30c7\u30e2<\/a><\/p>\n<h2 id=\"step2\">HTML\u3068css\u3068jQuery<\/h2>\n<p>\u3053\u306e\u6a5f\u80fd\u306fjQuery\u3067css\u3092\u64cd\u4f5c\u3057\u3066\u3001\u6587\u5b57\u30b5\u30a4\u30ba\u3092\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3 id=\"step2-1\">HTML<\/h3>\n<p>HTML\u3067\u306f\u5358\u7d14\u306b\u6587\u5b57\u30b5\u30a4\u30ba\u3092\u5909\u3048\u308b\u30dc\u30bf\u30f3\u3092\u8868\u793a\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u3002<\/p>\n<p>[html]<\/p>\n<h1>\u6587\u5b57\u30b5\u30a4\u30ba\u5909\u66f4<\/h1>\n<ul>\n<li id=\"fzS\">\u5c0f<\/li>\n<li id=\"fzM\">\u4e2d<\/li>\n<li id=\"fzL\">\u5927<\/li>\n<\/ul>\n<div id=\"content\">\n<p>\u6587\u5b57\u30b5\u30a4\u30ba\u5909\u3048\u308b\u305e\u30fc<\/p>\n<p>\u6587\u5b57\u30b5\u30a4\u30ba\u5909\u3048\u308b\u305e\u30fc<\/p>\n<p>\u6587\u5b57\u30b5\u30a4\u30ba\u5909\u3048\u308b\u305e\u30fc<\/p>\n<\/div>\n<p>[\/html]<\/p>\n<h3 id=\"step2-2\">css<\/h3>\n<p>css\u306f\u3001\u57fa\u672c\u7684\u306a\u6587\u5b57\u30b5\u30a4\u30ba\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u6587\u5b57\u30b5\u30a4\u30ba\u3092\u5909\u3048\u308b\u30dc\u30bf\u30f3\u306f\u3001\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u3092\u5909\u3048\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>[css]<br \/>\n#content {<br \/>\n  font-size: 100%;<br \/>\n}<br \/>\nli {<br \/>\n  font-size: 14px;<br \/>\n  font-weight: bold;<br \/>\n}<br \/>\n[\/css]<\/p>\n<h3 id=\"step2-3\">Javascript<\/h3>\n<p>\u30e1\u30a4\u30f3\u3068\u306a\u308bJavascript\u3067\u3059\u304c\u3001\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3089\u3001\u3069\u3046\u3044\u3046\u52d5\u304d\u3092\u3059\u308b\u304b\u3002\u3068\u3044\u3046\u306e\u3092\u66f8\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>[javascript]<br \/>\n$(function(){<br \/>\n\t\/\/\u30af\u30c3\u30ad\u30fc\u304c\u3042\u308c\u3070fontsize\u3092\u53d6\u5f97<br \/>\n\tvar fz = $.cookie(&#8216;fontSize&#8217;);<br \/>\n\t\/\/fzS = 75%;<br \/>\n\t\/\/fzM = 100%<br \/>\n\t\/\/fzL = 150%<br \/>\n\tif(fz) {<br \/>\n\t\tif(fz == &#8216;fzS&#8217;) {<br \/>\n\t\t\t$(&#8216;html&#8217;).css(&#8216;fontSize&#8217;, &#8216;75%&#8217;);<br \/>\n\t\t}else if(fz == &#8216;fzL&#8217;) {<br \/>\n\t\t\t$(&#8216;html&#8217;).css(&#8216;fontSize&#8217;, &#8216;150%&#8217;);<br \/>\n\t\t}<br \/>\n\t}<br \/>\n\t\/\/\u30b5\u30a4\u30ba\u5909\u66f4\u6642\u306b\u30af\u30c3\u30ad\u30fc\u306b\u4fdd\u5b58<br \/>\n\t$(&#8216;li&#8217;).click(function() {<br \/>\n\t\t\/\/id\u3092\u53d6\u5f97\u3059\u308b<br \/>\n\t\tvar thisSize = this.id;<br \/>\n\t\t\/\/\u30af\u30c3\u30ad\u30fc\u306b\u4fdd\u5b58<br \/>\n\t\t$.cookie(&#8216;fontSize&#8217;, thisSize);<br \/>\n\t\t\/\/\u30af\u30ea\u30c3\u30af\u3057\u305f\u30b5\u30a4\u30ba\u3092\u53cd\u6620<br \/>\n\t\tif(thisSize == &#8216;fzS&#8217;) {<br \/>\n\t\t\t$(&#8216;html&#8217;).css(&#8216;font-size&#8217;, &#8216;75%&#8217;);<br \/>\n\t\t}else if(thisSize == &#8216;fzM&#8217;) {<br \/>\n\t\t\t$(&#8216;html&#8217;).css(&#8216;font-size&#8217;, &#8216;100%&#8217;);<br \/>\n\t\t}else if(thisSize == &#8216;fzL&#8217;) {<br \/>\n\t\t\t$(&#8216;html&#8217;).css(&#8216;font-size&#8217;, &#8216;150%&#8217;);<br \/>\n\t\t}<br \/>\n\t});<br \/>\n});<br \/>\n[\/javascript]<\/p>\n<p>\u3055\u3066\u3001\u3053\u308c\u3092\u898b\u3066\u308f\u304b\u308b\u3088\u3046\u306b\u30af\u30c3\u30ad\u30fc\u3092\u4f7f\u3063\u3066\u3001\u30af\u30ea\u30c3\u30af\u3057\u305f\u5024\u3092\u4fdd\u5b58\u3055\u305b\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u30da\u30fc\u30b8\u3092\u307e\u305f\u3044\u3060\u308a\u3057\u3066\u3082\u3001\u6587\u5b57\u30b5\u30a4\u30ba\u306e\u5909\u66f4\u3092\u8a18\u61b6\u3057\u305f\u307e\u307e\u79fb\u52d5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 id=\"step3\">jquery.cookie.js<\/h2>\n<p>\u307e\u305a\u306f\u3001<a href=\"https:\/\/github.com\/carhartl\/jquery-cookie\" target=\"_blank\">jquery.cookie.js<\/a>\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3001jQuery\u306e\u5f8c\u306b\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<p>\u4fdd\u5b58\u3057\u3066\u3042\u308bcookie\u3092\u8aad\u307f\u51fa\u3059\u306e\u306f<br \/>\n[javascript]<br \/>\n$.cookie(&#8220;KEY&#8221;);<br \/>\n[\/javascript]<br \/>\n\u7c21\u5358\u3067\u3059\u306d\u3002<br \/>\n\u4eca\u56de\u306e\u5834\u5408\u30013\u884c\u76ee\u3067\u3059\u306d\u3002<\/p>\n<p>cookie\u3092\u4fdd\u5b58\u3059\u308b\u306b\u306f<br \/>\n[javascript]<br \/>\n$.cookie(&#8220;KEY&#8221;, &#8220;VALUE&#8221;, { expires: 7 });<br \/>\n[\/javascript]<br \/>\n\u3068\u8a18\u8f09\u3057\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u3067\u306f19\u884c\u76ee\u306b\u8a18\u8f09\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u4e2d\u3067\u3001KEY\u306f\u4fdd\u5b58\u3059\u308bcookie\u306e\u540d\u524d\u3002\u4eca\u56de\u306f\u300cfontSize\u300d\u3067\u3059\u3002<br \/>\nVALUE\u306f\u5024\u3067\u3059\u306d\u3002\u4eca\u56de\u306f\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u300cfzS\u300d\u300cfzM\u300d\u300cfzL\u300d\u306e\u3069\u308c\u304b\u304c\u5165\u308a\u307e\u3059\u3002<br \/>\n\u6700\u5f8c\u306e\u90e8\u5206\u306f\u30aa\u30d7\u30b7\u30e7\u30f3\u7684\u306a\u90e8\u5206\u3002<br \/>\nexpires\u306f\u6709\u52b9\u671f\u9650\u3002\u3053\u306e\u5834\u54087\u65e5\u9593\u3002<br \/>\n\u6307\u5b9a\u3057\u306a\u3044\u5834\u5408\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u3092\u6d88\u3059\u3068\u30af\u30c3\u30ad\u30fc\u3082\u6d88\u3048\u307e\u3059\u3002<br \/>\n\u305d\u306e\u4ed6\u306b\u3082\u6709\u52b9\u306a\u30c9\u30e1\u30a4\u30f3\u3068\u304b\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 id=\"step4\">\u307e\u3068\u3081<\/h2>\n<p>\u3053\u306e\u6587\u5b57\u30b5\u30a4\u30ba\u306e\u5909\u66f4\u6a5f\u80fd\u306f\u3001\u500b\u4eba\u7684\u306b\u306f\u5fc5\u8981\u306a\u3044\u6c17\u3082\u3057\u307e\u3059\u304c\u3001\u305d\u308c\u306f\u3042\u304f\u307e\u3067\u3082\u50d5\u306e\u5e74\u9f62\u3084\u3044\u3064\u3082\u30cd\u30c3\u30c8\u3057\u3066\u308b\u6642\u9593\u3060\u3063\u305f\u308a\u304c\u95a2\u4fc2\u3057\u3066\u3044\u308b\u304b\u3089\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3060\u304b\u3089\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u6587\u5b57\u30b5\u30a4\u30ba\u5909\u3048\u3089\u308c\u305f\u308a\u3001\u62e1\u5927\u3067\u304d\u305f\u308a\u3059\u308b\u306e\u3092\u77e5\u3089\u306a\u3044\u4eba\u306b\u3068\u3063\u3066\u306f\u3001\u5fc5\u8981\u306a\u3093\u3060\u308d\u3046\u306a\u3068\u3002<\/p>\n<p>\u6587\u5b57\u30b5\u30a4\u30ba\u306e\u5909\u66f4\u6a5f\u80fd\u306b\u3064\u3044\u3066\u3001\u306a\u308b\u307b\u3069\u3068\u601d\u3048\u308b\u8a18\u4e8b\u3092\u898b\u3064\u3051\u307e\u3057\u305f\u3002<br \/>\n\u300e<a href=\"http:\/\/website-usability.info\/2015\/02\/entry_150217.html\" target=\"_blank\">\u30a6\u30a7\u30d6\u30da\u30fc\u30b8\u306b\u6587\u5b57\u62e1\u5927\u6a5f\u80fd\u3092\u7f6e\u304f\u306e\u306f\u300c\u6642\u4ee3\u9045\u308c\u300d \u2014 Website Usability Info<\/a>\u300f<\/p>\n<p>\u3084\u306f\u308a\u95b2\u89a7\u30c7\u30d0\u30a4\u30b9\u3082\u591a\u69d8\u5316\u3057\u3066\u308b\u3057\u3001\u305d\u308c\u306b\u3088\u3063\u3066\u64cd\u4f5c\u3082\u9055\u3063\u3066\u304f\u308b\u304b\u3089\u3001\u300c\u6587\u5b57\u30b5\u30a4\u30ba\u306e\u5909\u66f4\u300d\u3067\u306f\u306a\u304f\u3001\u9055\u3046\u65b9\u6cd5\u3067\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u304c\u5fc5\u8981\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306d\u3002<br \/>\n\u305d\u3044\u304e\uff5e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>2\u6708\u3082\u3082\u3046\u304a\u3057\u307e\u3044\u3067\u3059\u306d\u3002 \u3082\u30461\u5e74\u306e6\u5206\u306e1\u304c\u7d42\u4e86\u3067\u3059\u3088\u3002\u9a5a\u304d\u3067\u3059\u3002 \u3055\u3066\u3001\u4e00&#8230;<\/p>\n","protected":false},"author":2,"featured_media":1083,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[133],"tags":[162],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts\/1081"}],"collection":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/comments?post=1081"}],"version-history":[{"count":0,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/posts\/1081\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/media\/1083"}],"wp:attachment":[{"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/media?parent=1081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/categories?post=1081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sriproot.net\/blog\/wp-json\/wp\/v2\/tags?post=1081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}