jQuery unpleasant Draggable, Resizable interaction

我只是一个虾纸丫 提交于 2019-12-11 01:17:56

问题


When I resize the first div it causes the next div to jump 'up' the column.

To recreate: top div drag the resize handle.

jQuery $(function() { $('.portlet').draggable({ grid: [25, 25] }).resizable({ grid: [25, 25] }); });

Layout

<div class="portlet" id="P2">
    <div class="portlet-header"><h3>News</h3></div>
    <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
<div class="portlet" id="Div1">
    <div class="portlet-header"><h3>Feeds</h3></div>
    <div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>

CSS

.portlet { min-width: 100px; min-height: 100px; width: 100px; height: 100px; background-color: #C0C0C0; }


回答1:


Give #Div1 an absolute positioning of top:100px and it should stay put when resizing #P2. On initial resize of #Div1 it's inline positioning becomes changed and the browser bumps up #Div1 as you describe.



来源:https://stackoverflow.com/questions/5326030/jquery-unpleasant-draggable-resizable-interaction

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