{"id":3761,"date":"2023-12-22T13:22:19","date_gmt":"2023-12-22T04:22:19","guid":{"rendered":"https:\/\/taitan916.info\/blog\/?p=3761"},"modified":"2023-12-22T13:22:19","modified_gmt":"2023-12-22T04:22:19","slug":"post-3761","status":"publish","type":"post","link":"https:\/\/taitan916.info\/blog\/archives\/3761","title":{"rendered":"\u30a2\u30f3\u30ab\u30fc\u30ea\u30f3\u30af\u3067URL\u306b\u300c#hoge\u300d\u306e\u3088\u3046\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6b8b\u3055\u305a\u30b9\u30af\u30ed\u30fc\u30eb\u3055\u305b\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>\u30a2\u30f3\u30ab\u30fc\u30bf\u30b0\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3082\u30d6\u30e9\u30a6\u30b6\u306eURL\u6b04\u306b\u300c#hoge\u300d\u306e\u3088\u3046\u306a\u30cf\u30c3\u30b7\u30e5\u3092\u6b8b\u3055\u305a\u306b\u6307\u5b9a\u306e\u8981\u7d20\u307e\u3067\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u304d\u308b\u3068\u3044\u3046\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u30c7\u30fc\u30bf\u304c\u3042\u3063\u305f\u3002\u3057\u304b\u3082\u4ed6\u30da\u30fc\u30b8\u304b\u3089\u30cf\u30c3\u30b7\u30e5\u4ed8\u304d\u306eURL\u3067\u9077\u79fb\u3057\u3066\u304d\u3066\u3082\u30b9\u30af\u30ed\u30fc\u30eb\u5f8c\u306b\u30cf\u30c3\u30b7\u30e5\u304c\u6d88\u3048\u308b\u3088\u3046\u306a\u6319\u52d5\u3092\u53d6\u3063\u3066\u304a\u308a\u3001\u3069\u3046\u3044\u3046\u624b\u6bb5\u306a\u306e\u304b\u6c17\u306b\u306a\u3063\u305f\u306e\u3067\u30e1\u30e2\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb<\/h2>\n<p><a href=\"https:\/\/taitan916.info\/sample\/anchor_link\/\" target=\"_blank\" rel=\"noopener\">https:\/\/taitan916.info\/sample\/anchor_link\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;html lang=\"ja\"&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\"&gt;\r\n&lt;title&gt;\u30a2\u30f3\u30ab\u30fc\u30bf\u30b0\u3067\u30b9\u30af\u30ed\u30fc\u30eb\u30c6\u30b9\u30c8&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;a href=\"#test1\"&gt;test1&lt;\/a&gt;\r\n    &lt;a href=\"#test2\"&gt;test2&lt;\/a&gt;\r\n    &lt;a href=\"#test3\"&gt;test3&lt;\/a&gt;\r\n    &lt;div style=\"background-color: #f00; height: 1000px;\" id=\"test1\"&gt;&lt;\/div&gt;\r\n    &lt;div style=\"background-color: #0f0; height: 1000px;\" id=\"test2\"&gt;&lt;\/div&gt;\r\n    &lt;div style=\"background-color: #00f; height: 1000px;\" id=\"test3\"&gt;&lt;\/div&gt;\r\n    &lt;script type=\"text\/javascript\" src=\"https:\/\/code.jquery.com\/jquery-3.5.1.js\"&gt;&lt;\/script&gt;\r\n    &lt;script type=\"text\/javascript\"&gt;\r\n    $(function(){\r\n\r\n        const hash = decodeURI(location.hash);\r\n        if(hash){\r\n            $(\"html, body\").animate({scrollTop:$(hash).offset().top});\r\n            window.history.replaceState(null, '', window.location.pathname + window.location.search);\r\n        }\r\n\r\n        $('a[href^=\"#\"]').click(function(){\r\n            const href= $(this).attr(\"href\");\r\n            const target = $(href == \"#\" || href == \"\" ? 'html' : href);\r\n            $(\"html, body\").animate({scrollTop:target.offset().top});\r\n            window.history.replaceState(null, '', window.location.pathname + window.location.search);\r\n            return false;\r\n        });\r\n    });\r\n    &lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u4ed6\u30da\u30fc\u30b8\u304b\u3089\u9077\u79fb\u3057\u3066\u304d\u305f\u969b\u306f\u300cif(hash){\u300d\u306e\u3068\u3053\u308d\u3067\u3001\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u969b\u306f\u300c$('a[href^=\"#\"]').click(function(){\u300d\u3067\u691c\u77e5\u3057\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u305f\u5f8c\u306bpushState\u3067\u30cf\u30c3\u30b7\u30e5\u3092\u524a\u9664\u3057\u3066\u3044\u308b\u3002\u5c1a\u3001\u30cf\u30c3\u30b7\u30e5\u306f\u7279\u306b\u524a\u9664\u3057\u306a\u304f\u3066\u3082\u3044\u3044\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u5f62\u3067OK\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$(function(){\r\n    $('a[href^=\"#\"]').click(function(){\r\n        const href= $(this).attr(\"href\");\r\n        const target = $(href == \"#\" || href == \"\" ? 'html' : href);\r\n        $(\"html, body\").animate({scrollTop:target.offset().top});\r\n        return false;\r\n    });\r\n});<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u6240\u611f<\/h2>\n<p>URL\u306f\u3067\u304d\u308b\u3060\u3051\u30b7\u30f3\u30d7\u30eb\u306a\u65b9\u304c\u826f\u3044\u6d3e\u306a\u306e\u3067\u4eca\u5f8c\u3082\u4f7f\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u3053\u308d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30a2\u30f3\u30ab\u30fc\u30bf\u30b0\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u3082\u30d6\u30e9\u30a6\u30b6\u306eURL\u6b04\u306b\u300c#hoge\u300d\u306e\u3088\u3046\u306a\u30cf\u30c3\u30b7\u30e5\u3092 ... <\/p>\n","protected":false},"author":1,"featured_media":1071,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-3761","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery","category-javascript"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/3761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/comments?post=3761"}],"version-history":[{"count":0,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/3761\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media\/1071"}],"wp:attachment":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media?parent=3761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/categories?post=3761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/tags?post=3761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}