Jquery UI Draggable Absolute Instead of Relative?

前端 未结 4 1910
半阙折子戏
半阙折子戏 2021-02-18 20:18

I have a div containing a few jquery draggables, however if at any point I remove one of these draggables from the page then this can move the rest of them as they are positione

4条回答
  •  逝去的感伤
    2021-02-18 21:17

    Perhaps not the best ideas but... You could position all the relevant divs using positon:relative; and then include a function call in your or $("document").ready(), if you're using jQuery, whic iterates through each of the divs to translate their relative positions into absolute and set them as their left, top before changing them to position:absolute. Only problem here is that you'd want each divs absolute position prior to updating their styles so as not to alter the layout through iteration.

提交回复
热议问题