<p>sdfa</p>
<p>asdf</p>
<div class="parent">
  <div id="el">1000px以上</div>
</div>
.parent {
  position: relative;
  top: 10px;
}
View Compiled
const el = document.querySelector('#el');
const resizeObserver = new ResizeObserver(entries => {
  for (let entry of entries) {
    console.log(entry);
    el.innerText = entry.contentRect.width >= 1000 ? '1000px 以上' : '1000px 未満';
  }
});
resizeObserver.observe(document.querySelector('#el'));
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.