Is there any non-polling way to detect when a DOM element's size or position have changed?

后端 未结 3 644
逝去的感伤
逝去的感伤 2021-02-01 17:01

For a long time, I\'ve been looking for a way to detect when a DOM element\'s size or position has changed. It could be because the window resized, or because new child elements

3条回答
  •  既然无缘
    2021-02-01 17:21

    A co-worker pointed me to a technique that uses the underflow and overflow events. I haven't tried it, and I have no idea what kind of browser support there is (looks like Chrome and FireFox, and it should work in IE by synthesizing the same events that browser would look for, but I have no idea which versions support the technique).

提交回复
热议问题