{"id":896,"date":"2019-03-06T13:41:12","date_gmt":"2019-03-06T04:41:12","guid":{"rendered":"https:\/\/takaya-com.jp\/archives\/?p=896"},"modified":"2019-03-07T14:45:02","modified_gmt":"2019-03-07T05:45:02","slug":"%e3%80%8e%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%ad%e3%83%bc%e3%83%98%e3%83%83%e3%83%80%e3%83%bc%e3%80%8f%e3%81%a7%e5%9b%ba%e5%ae%9a%e3%83%8a%e3%83%93%e3%82%b2%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3","status":"publish","type":"post","link":"https:\/\/takaya-com.jp\/archives\/2019\/03\/%e3%80%8e%e3%82%b9%e3%83%86%e3%82%a3%e3%83%83%e3%82%ad%e3%83%bc%e3%83%98%e3%83%83%e3%83%80%e3%83%bc%e3%80%8f%e3%81%a7%e5%9b%ba%e5%ae%9a%e3%83%8a%e3%83%93%e3%82%b2%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3\/","title":{"rendered":"\u300e\u30b9\u30c6\u30a3\u30c3\u30ad\u30fc\u30d8\u30c3\u30c0\u30fc\u300f\u3067\u3001\u4eca\u65e5\u304b\u3089\u3059\u3063\u304d\u308a\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\uff01\uff01"},"content":{"rendered":"<p>jQuery\u3067\u4f5c\u308b\u3001<b>\u300e\u30b9\u30c6\u30a3\u30c3\u30ad\u30fc\u30d8\u30c3\u30c0\u30fc(Sticky header)\u300f<\/b>\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u30b9\u30c6\u30a3\u30c3\u30ad\u30fc\u30d8\u30c3\u30c0\u30fc\u306f\u3001\u30b7\u30f3\u30d7\u30ebjQuery\u3067\u5b9f\u88c5\u3067\u304d\u3001<b>\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u3082\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u3092\u898b\u5931\u3044\u307e\u305b\u3093<\/b>\u3002<br \/>\n\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u3092\u30b9\u30c3\u30ad\u30ea\u3055\u305b\u3064\u3064\u3001\u8ff7\u5b50\u77e5\u3089\u305a\uff01<\/p>\n<p>Window\u306e\u30b9\u30af\u30ed\u30fc\u30eb\u30a4\u30d9\u30f3\u30c8\u306b\u3088\u308b\u30af\u30e9\u30b9\u306e\u8131\u7740\u306e\u307f\u306e\u30b7\u30f3\u30d7\u30eb\u69cb\u9020\u3002<br \/>\n\u7279\u5b9a\u306e\u4f4d\u7f6e\u307e\u3067\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u305f\u3089\u30d8\u30c3\u30c0\u30fc\u306b\u30af\u30e9\u30b9\u3092\u3064\u3051\u3066CSS\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30c7\u30e2\u3067\u306f\u3001CSS\u306b\u3061\u3087\u3063\u3074\u308a\u3072\u3068\u5de5\u592b\u3002<br \/>\n\u30d8\u30c3\u30c0\u30fc\u30e1\u30cb\u30e5\u30fc\u3092\u30d1\u30fc\u30bb\u30f3\u30c8\u8868\u793a\u306b\u3059\u308b\u3053\u3068\u3067\u30ec\u30b9\u30dd\u30f3\u30b7\u30d6\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u3042\u306a\u305f\u306e\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u306b\u3082\u3001<b>\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u304c\u4e0a\u90e8\u56fa\u5b9a\u3055\u308c\u308b\u300e\u30b9\u30c6\u30a3\u30c3\u30ad\u30fc\u30d8\u30c3\u30c0\u30fc\u300f<\/b>\u3092\u53d6\u308a\u5165\u308c\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\uff01\uff01<\/p>\n<p><!--more--><br \/>\n\u2193\u4ee5\u4e0b\u304c\u30b3\u30fc\u30c9\u30b5\u30f3\u30d7\u30eb\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u25bcjQuery<\/p>\n<pre class=\"lang:js decode:true \" title=\"jQuery\" >&lt;script type=\"text\/javascript\"&gt;\r\n$(function(){\r\n\tvar _window = $(window),\r\n\t\t_header = $('.site-header'),\r\n\t\thelloBottom;\r\n\t\r\n\t_window.on('scroll',function(){\t\t\r\n\t\thelloBottom = $('.hello').height();\r\n\t\tif(_window.scrollTop() &gt; helloBottom){\r\n\t\t\t_header.addClass('fixed');   \r\n\t\t}\r\n\t\telse{\r\n\t\t\t_header.removeClass('fixed');   \r\n\t\t}\r\n\t});\r\n\t\r\n\t_window.trigger('scroll');\r\n});\r\n&lt;\/script&gt;<\/pre>\n<p>\u25bcCSS<\/p>\n<pre class=\"lang:css decode:true \" title=\"CSS\" >.site-header{\r\n\tbackground: #ffffff;\r\n\tdisplay: flex;\r\n\tpadding: 20px;\r\n\tposition: absolute;\r\n\tjustify-content: space-between;\r\n\twidth: 100%;\r\n}\r\n.site-header.fixed{\r\n\tposition: fixed;\r\n\ttop: 0;\r\n}\r\n.content{\r\n\tline-height: 1.6;\r\n\tmargin: 0 auto;\r\n\tpadding-top: 100px;\r\n\twidth: 800px;\r\n}\r\n\r\n@media screen and (max-width:750px) {\r\n    .site-header{\r\n        font-size: 80%;\r\n    }\r\n    .content{\r\n        width: 90%;\r\n    }\r\n}<\/pre>\n<p>\u25bcHTML<\/p>\n<pre class=\"lang:xhtml decode:true \" title=\"html\" >&lt;div class=\"hello\"&gt;\r\n&lt;img src=\"#\" width=\"1600\" height=\"1200\" alt=\"hello\"&gt;\r\n&lt;\/div&gt;\r\n    &lt;header class=\"site-header fixed\"&gt;\r\n\t\t&lt;h1&gt;\r\n            &lt;a href=\"#\"&gt;Home&lt;\/a&gt;\r\n        &lt;\/h1&gt;\r\n\t\t&lt;nav class=\"gnav\"&gt;\r\n\t\t\t&lt;ul class=\"gnav_menu\"&gt;\r\n\t\t\t\t&lt;li class=\"gnav_menu_tag\"&gt;&lt;a href=\"#\"&gt;News&lt;\/a&gt;&lt;\/li&gt;\r\n\t\t\t\t&lt;li class=\"gnav_menu_tag\"&gt;&lt;a href=\"#\"&gt;About&lt;\/a&gt;&lt;\/li&gt;\r\n\t\t\t\t&lt;li class=\"gnav_menu_tag\"&gt;&lt;a href=\"#\"&gt;Service&lt;\/a&gt;&lt;\/li&gt;\r\n\t\t\t\t&lt;li class=\"gnav_menu_tag\"&gt;&lt;a href=\"#\"&gt;SNS&lt;\/a&gt;&lt;\/li&gt;\r\n\t\t\t\t&lt;li class=\"gnav_menu_tag\"&gt;&lt;a href=\"#\"&gt;Contact&lt;\/a&gt;&lt;\/li&gt;\r\n\t\t\t&lt;\/ul&gt;\r\n\t\t&lt;\/nav&gt;\r\n\t&lt;\/header&gt;\t<\/pre>\n<p>\u4eca\u56de\u3001\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u306e\u306f\u3001<br \/>\n<a href=\"https:\/\/webdesignday.jp\/inspiration\/technique\/css\/4166\/\" target=\"_blank\">\u30d8\u30c3\u30c0\u30fc\u30fb\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u3092\u56fa\u5b9a\u8868\u793a\u3055\u305b\u308b\u30a2\u30a4\u30c7\u30a25\u3064 &#8211; WEBDESIGNDAY<\/a>\u3055\u3093\u306e\u300eContents 3 \u9014\u4e2d\u304b\u3089\u56fa\u5b9a\u8868\u793a\u300f\u306e\u30da\u30fc\u30b8\u3067\u3059\u3002<br \/>\n\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.takaya-com.jp\/archives\/demo\/st_head_files\/\" target=\"_blank\">\u30c7\u30e2\u30da\u30fc\u30b8\u306f\u3001\u3053\u3061\u3089<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>jQuery\u3067\u4f5c\u308b\u3001\u300e\u30b9\u30c6\u30a3\u30c3\u30ad\u30fc\u30d8\u30c3\u30c0\u30fc(Sticky header)\u300f\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u30b9\u30c6\u30a3\u30c3\u30ad\u30fc\u30d8\u30c3\u30c0\u30fc\u306f\u3001\u30b7\u30f3\u30d7\u30ebjQuery\u3067\u5b9f\u88c5\u3067\u304d\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u3082\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u3092\u898b\u5931\u3044\u307e\u305b\u3093\u3002 \u30db\u30fc\u30e0\u30da\u30fc\u30b8\u3092\u30b9\u30c3\u30ad\u30ea\u3055\u305b [&hellip;]<\/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\/896"}],"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=896"}],"version-history":[{"count":35,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/896\/revisions"}],"predecessor-version":[{"id":960,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/posts\/896\/revisions\/960"}],"wp:attachment":[{"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/media?parent=896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/categories?post=896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/takaya-com.jp\/archives\/wp-json\/wp\/v2\/tags?post=896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}