Recalculating absolute positioned elements position?

别等时光非礼了梦想. 提交于 2019-12-10 18:54:10

问题


I have some elements positioned absolutely, relative to document body.

When something is appended, somewhere inside DOM, then absolute positioned elements should be repositioned as well.

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?

UPDATE http://jsfiddle.net/9nkq9/


回答1:


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:

http://jsfiddle.net/9nkq9/1/



来源:https://stackoverflow.com/questions/7300242/recalculating-absolute-positioned-elements-position

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!