重新计算绝对定位元素的位置?
我有一些相对于文档正文绝对定位的元素.
I have some elements positioned absolutely, relative to document body.
在DOM内的某处附加了某些内容后,也应该重新定位绝对定位的元素.
When something is appended, somewhere inside DOM, then absolute positioned elements should be repositioned as well.
问题是,如何知道DOM在内部某个地方被更改了?
The question is, how to know that DOM was changed somewhere there inside?
第二个想法是听文档的高度和宽度变化,我认为这是最有效的方法.
The second idea was to listen to document height and width changes, which i think is the most efficient way to do it.
还有其他方法可以做到吗?
Are there any other ways to accomplish that?
绝对定位的元素是否需要相对于身体定位?
Do the absolutely positioned elements need to be positioned relative to the body?
通过将它们包装在相对位置的容器中,就我所知,可以实现结果:
By wrapping them in a container positioned relative you can acheive the result as I understand it: