<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>todays_mitsui</author_name>
  <author_url>https://blog.hatena.ne.jp/todays_mitsui/</author_url>
  <blog_title>無駄と文化</blog_title>
  <blog_url>https://blog.mudatobunka.org/</blog_url>
  <categories>
    <anon>JavaScript</anon>
    <anon>プログラミング</anon>
    <anon>フロントエンド</anon>
  </categories>
  <description>JavaScript を使って画面上の要素を入れ替えたとき、スクロール位置が勝手に動いて画面がカクつくという現象に遭遇しました。調査して分かったことをまとめます。 まずはデモをご覧ください todays-mitsui.github.io カラフルな &lt;div&gt; が並んでいて、右上のボタンを押すとすぐ上の要素と位置が入れ替わるデモを作りました。 ボタンを押すとすぐ上の要素と入れ替わる ここまではなんの変哲もありません。ところが、まったく同じコードでも要素が大きくなると違う挙動になります。 すぐ上の要素と入れ替わる、と同時にスクロール位置がシフトする ボタンを押すと同時にスクロール位置がシフトして…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.mudatobunka.org%2Fentry%2F2025%2F02%2F03%2F100000&quot; title=&quot;要素を入れ替えたときにスクロール位置が追従することがあるみたい - 無駄と文化&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/t/todays_mitsui/20250201/20250201174405.gif</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-02-03 10:00:00</published>
  <title>要素を入れ替えたときにスクロール位置が追従することがあるみたい</title>
  <type>rich</type>
  <url>https://blog.mudatobunka.org/entry/2025/02/03/100000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
