Jquery UI resizable issue expands beyond containment (draggable also used)

旧街凉风 提交于 2020-01-02 07:02:15

问题


The problem i am facing is with the resizability of the div. When i use it with Draggable, it gives the problem and not able to resize it width-wise.

If i use the resizable alone, then it is fine. But i need to make it work with draggable feature.

Pls suggest.

click the jsFiddle link for the demo.


回答1:


Adding a position:relative; to the container solves the issue.

See this working Fiddle Example!

#ParentDIV {
    position: relative;
}



回答2:


If your draggable element is absolutely positioned and your container is absolutely positioned you can set the dragged element to a fixed width and height. This will create a bounding box and prevent the draggable from falling off the edges.

#container {
    position:absolute;
}

#draggedObject {
    position:absolute:
    width: 100px;
    height: 50px;
}


来源:https://stackoverflow.com/questions/10980833/jquery-ui-resizable-issue-expands-beyond-containment-draggable-also-used

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