{"id":3077,"date":"2025-10-16T00:55:00","date_gmt":"2025-10-16T00:55:00","guid":{"rendered":"https:\/\/satokotadesign.com\/blog\/?p=3077"},"modified":"2025-10-16T00:55:00","modified_gmt":"2025-10-16T00:55:00","slug":"intersection-observer","status":"publish","type":"post","link":"https:\/\/satokotadesign.com\/blog\/intersection-observer\/","title":{"rendered":"\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u6570\u5b57\u304c\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\uff01Intersection Observer\u3067\u5b9f\u88c5\u3059\u308b\u8efd\u91cf\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01\u9759\u5ca1\u770c\u6d5c\u677e\u5e02\u3067WEB\u30c7\u30b6\u30a4\u30ca\u30fc\u3092\u3057\u3066\u3044\u307e\u3059\u5c0f\u7027\u3067\u3059\u3002<br \/>\n\u4eca\u56de\u306f\u300c\u30da\u30fc\u30b8\u3092\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308b\u3068\u3001\u6570\u5b57\u304c\u30b9\u30c3\u3068\u5897\u3048\u3066\u3044\u304f\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u6f14\u51fa\u300d\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f01\u696d\u30b5\u30a4\u30c8\u306e<strong>\u5b9f\u7e3e\u7d39\u4ecb<\/strong>\u3084<strong>\u6570\u5024\u30c7\u30fc\u30bf\u306e\u53ef\u8996\u5316<\/strong>\u306b\u3074\u3063\u305f\u308a\u306a\u6f14\u51fa\u3067\u3001<br \/>\n\u898b\u305b\u65b9\u3072\u3068\u3064\u3067\u30da\u30fc\u30b8\u5168\u4f53\u304c\u201c\u52d5\u304d\u306e\u3042\u308b\u5370\u8c61\u201d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001JavaScript\u3068Intersection Observer\u3092\u4f7f\u3063\u305f\u5b9f\u88c5\u65b9\u6cd5\u3092\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">\u30b9\u30af\u30ed\u30fc\u30eb\u9023\u52d5\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u3068\u306f\uff1f<\/span><\/h2>\n<p>\u300c\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u300d\u3068\u306f\u3001<br \/>\n\u30e6\u30fc\u30b6\u30fc\u304c\u753b\u9762\u3092\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u7279\u5b9a\u306e\u8981\u7d20\u304c\u8868\u793a\u3055\u308c\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u3001<br \/>\n\u6570\u5b57\u304c\u300c0 \u2192 \u6307\u5b9a\u5024\u300d\u306b\u5411\u304b\u3063\u3066\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3057\u306a\u304c\u3089\u5909\u5316\u3059\u308b\u8868\u73fe\u3067\u3059\u3002<\/p>\n<div class=\"sc_designlist ul fa_check blue\">\n<ul>\n<li>\u6570\u5b57\u306b\u201c\u52d5\u304d\u201d\u304c\u52a0\u308f\u308a\u3001\u8996\u7dda\u3092\u5f15\u304d\u3064\u3051\u308b<\/li>\n<li>\u30b5\u30fc\u30d3\u30b9\u5b9f\u7e3e\u3084\u7d71\u8a08\u30c7\u30fc\u30bf\u3092\u5370\u8c61\u7684\u306b\u898b\u305b\u3089\u308c\u308b<\/li>\n<li>\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u81ea\u7136\u306b\u518d\u751f\u3055\u308c\u308b\u305f\u3081\u64cd\u4f5c\u304c\u4e0d\u8981<\/li>\n<\/ul>\n<\/div>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">\u30c7\u30e2\u30b3\u30fc\u30c9<\/span><\/h2>\n<p class=\"codepen\" data-height=\"300\" data-default-tab=\"html,result\" data-slug-hash=\"ogbobrm\" data-pen-title=\"Untitled\" data-user=\"ekwwawpb-the-styleful\" style=\"height: 300px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/ekwwawpb-the-styleful\/pen\/ogbobrm\"><br \/>\n  Untitled<\/a> by \u5c0f\u7027\u8ce2 (<a href=\"https:\/\/codepen.io\/ekwwawpb-the-styleful\">@ekwwawpb-the-styleful<\/a>)<br \/>\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\n<\/p>\n<p><script async src=\"https:\/\/public.codepenassets.com\/embed\/index.js\"><\/script><\/p>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">\u57fa\u672c\u306eHTML\u69cb\u9020<\/span><\/h2>\n<p>\u307e\u305a\u306f\u3001\u6570\u5b57\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306e\u30b7\u30f3\u30d7\u30eb\u306aHTML\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"line-numbers\" ><code class=\"language-markup\">&lt;section class=&quot;stats&quot;&gt;\r\n  &lt;div class=&quot;stat-item&quot;&gt;\r\n    &lt;span class=&quot;count&quot; data-target=&quot;1200&quot;&gt;0&lt;\/span&gt;\r\n    &lt;p&gt;\u9867\u5ba2\u6570&lt;\/p&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div class=&quot;stat-item&quot;&gt;\r\n    &lt;span class=&quot;count&quot; data-target=&quot;98&quot;&gt;0&lt;\/span&gt;\r\n    &lt;p&gt;\u6e80\u8db3\u5ea6\uff08\uff05\uff09&lt;\/p&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/section&gt;<\/code><\/pre>\n<span class=\"fontbackground\" style=\"background:;\">data-target<\/span>\u5c5e\u6027\u306b\u3001\u6700\u7d42\u7684\u306b\u5230\u9054\u3055\u305b\u305f\u3044\u6570\u5b57\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">CSS\u3067\u30ec\u30a4\u30a2\u30a6\u30c8\u3092\u6574\u3048\u308b<\/span><\/h2>\n<p>\u6570\u5b57\u304c\u4e2d\u592e\u306b\u914d\u7f6e\u3055\u308c\u308b\u3088\u3046\u3001\u7c21\u5358\u306b\u30b9\u30bf\u30a4\u30ea\u30f3\u30b0\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"line-numbers\" ><code class=\"language-css\">  .stats {\r\n    display: flex;\r\n    justify-content: center;\r\n    gap: 80px;\r\n    padding: 100px 0;\r\n    background: #f5f5f5;\r\n  }\r\n  .stat-item {\r\n    text-align: center;\r\n    font-family: &quot;Poppins&quot;, sans-serif;\r\n  }\r\n  .count {\r\n    font-size: 3rem;\r\n    font-weight: bold;\r\n    color: #0078ff;\r\n  }<\/code><\/pre>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">JavaScript\u3067\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u51e6\u7406\u3092\u5b9f\u88c5<\/span><\/h2>\n<p>Intersection Observer\u3092\u4f7f\u3063\u3066\u3001\u8981\u7d20\u304c\u753b\u9762\u306b\u73fe\u308c\u305f\u3089\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u59cb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"line-numbers\" ><code class=\"language-js\"> const counters = document.querySelectorAll(&quot;.count&quot;);\r\n  const options = { threshold: 0.5 };\r\n  const observer = new IntersectionObserver((entries, observer) =&gt; {\r\n    entries.forEach((entry) =&gt; {\r\n      if (entry.isIntersecting) {\r\n        const counter = entry.target;\r\n        const updateCount = () =&gt; {\r\n          const target = +counter.getAttribute(&quot;data-target&quot;);\r\n          const current = +counter.innerText;\r\n          const increment = target \/ 100;\r\n          if (current &lt; target) {\r\n            counter.innerText = Math.ceil(current + increment);\r\n            requestAnimationFrame(updateCount);\r\n          } else {\r\n            counter.innerText = target;\r\n          }\r\n        };\r\n        updateCount();\r\n        observer.unobserve(counter);\r\n      }\r\n    });\r\n  }, options);\r\n  counters.forEach((counter) =&gt; {\r\n    observer.observe(counter);\r\n  });<\/code><\/pre>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">\u30dd\u30a4\u30f3\u30c8\u3068\u5fdc\u7528\u30a2\u30a4\u30c7\u30a2<\/span><\/h2>\n<div class=\"sc_designlist ul fa_check blue\">\n<ul>\n<li>IntersectionObserver\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u4e00\u5ea6\u3060\u3051\u518d\u751f\u3067\u304d\u308b\u4ed5\u7d44\u307f\u304c\u7c21\u5358\u306b\u4f5c\u308c\u308b<\/li>\n<li>\u6570\u5b57\u306e\u5897\u52a0\u30b9\u30d4\u30fc\u30c9\u3092\u5909\u3048\u305f\u3044\u5834\u5408\u306f\u3001<span class=\"fontbackground\" style=\"background:;\">target \/ 100<\/span> \u306e\u5024\u3092\u8abf\u6574<\/li>\n<li>\u300c\uff0b\u300d\u8a18\u53f7\u3084\u300c\uff05\u300d\u3092\u5f8c\u308d\u306b\u3064\u3051\u3066\u3001\u3088\u308a\u81ea\u7136\u306a\u898b\u305b\u65b9\u306b<\/li>\n<\/ul>\n<\/div>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">\u767a\u5c55\u7248\uff1a\u30b9\u30af\u30ed\u30fc\u30eb\u91cf\u306b\u5fdc\u3058\u3066\u6570\u5024\u3092\u5909\u5316\u3055\u305b\u308b<\/span><\/h2>\n<p>\u30b9\u30af\u30ed\u30fc\u30eb\u4f4d\u7f6e\u306b\u3088\u3063\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u6570\u5024\u304c\u5909\u5316\u3059\u308b\u8868\u73fe\u3082\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306f\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u91cf\u3092window.scrollY\u304b\u3089\u53d6\u5f97\u3057\u3066\u30ab\u30a6\u30f3\u30c8\u306b\u53cd\u6620\u3059\u308b\u4f8b\u3067\u3059\u3002<\/p>\n<p class=\"codepen\" data-height=\"300\" data-default-tab=\"html,result\" data-slug-hash=\"MYKOyWO\" data-pen-title=\"Untitled\" data-user=\"ekwwawpb-the-styleful\" style=\"height: 300px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\">\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/ekwwawpb-the-styleful\/pen\/MYKOyWO\"><br \/>\n  Untitled<\/a> by \u5c0f\u7027\u8ce2 (<a href=\"https:\/\/codepen.io\/ekwwawpb-the-styleful\">@ekwwawpb-the-styleful<\/a>)<br \/>\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\n<\/p>\n<p><script async src=\"https:\/\/public.codepenassets.com\/embed\/index.js\"><\/script><\/p>\n<p>\u30da\u30fc\u30b8\u5168\u4f53\u306e\u9032\u884c\u5ea6\u3092\u300c\u6570\u5024\u300d\u3067\u8996\u899a\u5316\u3067\u304d\u308b\u305f\u3081\u3001<br \/>\n<strong>\u9032\u6357\u30d0\u30fc\u3084\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u4ed8\u304d\u30ab\u30a6\u30f3\u30bf\u30fc<\/strong>\u306b\u3082\u5fdc\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 class=\"sc_heading solid blue\"><span class=\"sc_title\">\u307e\u3068\u3081<\/span><\/h2>\n<div class=\"sc_frame_wrap inline blue\">\n<div class=\"sc_frame_title\">\u30b9\u30af\u30ed\u30fc\u30eb\u9023\u52d5\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u306e\u9b45\u529b<\/div>\n<div class=\"sc_frame\">\u30fb\u6570\u5b57\u304c\u52d5\u304f\u3060\u3051\u3067\u30b5\u30a4\u30c8\u304c\u52d5\u7684\u306b\u898b\u3048\u308b<br \/>\n\u30fbIntersection Observer\u3067\u5b9f\u88c5\u3082\u8efd\u91cf<br \/>\n\u30fb\u30e6\u30fc\u30b6\u30fc\u306e\u76ee\u3092\u5f15\u304f\u300c\u4fe1\u983c\u611f\u30a2\u30c3\u30d7\u6f14\u51fa\u300d\u306b\u3082\u52b9\u679c\u7684 <\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<p><figure id=\"attachment_475\" aria-describedby=\"caption-attachment-475\" style=\"width: 1500px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/satokotadesign.com\/\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr.jpg\" alt=\"\u9759\u5ca1\u770c\u6d5c\u677e\u5e02\u3067\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u5236\u4f5c\u306a\u3089satokotadesign\" width=\"1500\" height=\"500\" class=\"size-full wp-image-475\" srcset=\"https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr.jpg 1500w, https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr-500x167.jpg 500w, https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr-1024x341.jpg 1024w, https:\/\/satokotadesign.com\/blog\/wp-content\/uploads\/2022\/10\/bnr-768x256.jpg 768w\" sizes=\"auto, (max-width: 1500px) 100vw, 1500px\" \/><\/a><figcaption id=\"caption-attachment-475\" class=\"wp-caption-text\"><a href=\"https:\/\/satokotadesign.com\/contact\/\" target=\"_blank\" rel=\"noopener\">\u9759\u5ca1\u770c\u6d5c\u677e\u5e02\u3067\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u5236\u4f5c\u306a\u3089satokotadesign<\/a><\/figcaption><\/figure><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\uff01\u9759\u5ca1\u770c\u6d5c\u677e\u5e02\u3067WEB\u30c7\u30b6\u30a4\u30ca\u30fc\u3092\u3057\u3066\u3044\u307e\u3059\u5c0f\u7027\u3067\u3059\u3002 \u4eca\u56de\u306f\u300c\u30da\u30fc\u30b8\u3092\u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308b\u3068\u3001\u6570\u5b57\u304c\u30b9\u30c3\u3068\u5897\u3048\u3066\u3044\u304f\u30ab\u30a6\u30f3\u30c8\u30a2\u30c3\u30d7\u6f14\u51fa\u300d\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u4f01\u696d\u30b5\u30a4\u30c8\u306e\u5b9f\u7e3e\u7d39\u4ecb\u3084\u6570\u5024\u30c7\u30fc\u30bf\u306e\u53ef\u8996\u5316\u306b\u3074\u3063\u305f\u308a\u306a\u6f14\u51fa\u3067\u3001 \u898b\u305b\u65b9\u3072\u3068\u3064\u3067\u30da\u30fc\u2026<\/p>\n","protected":false},"author":1,"featured_media":3082,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7],"tags":[8],"class_list":["post-3077","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web","tag-javascript"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/posts\/3077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/comments?post=3077"}],"version-history":[{"count":4,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/posts\/3077\/revisions"}],"predecessor-version":[{"id":3081,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/posts\/3077\/revisions\/3081"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/media\/3082"}],"wp:attachment":[{"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/media?parent=3077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/categories?post=3077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/satokotadesign.com\/blog\/wp-json\/wp\/v2\/tags?post=3077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}