Jquery UI可调整大小的问题扩展到包含范围之外(也可以使用draggable)

时间:2021-06-11 20:38:53

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.

我面临的问题是div的可恢复性。当我使用Draggable时,它会出现问题而无法在宽度方面调整大小。

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.

单击演示的jsFiddle链接。

2 个解决方案

#1


6  

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

添加位置:相对;到容器解决问题。

See this working Fiddle Example!

看到这个工作小提琴示例!

#ParentDIV {
    position: relative;
}

#2


0  

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;
}

#1


6  

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

添加位置:相对;到容器解决问题。

See this working Fiddle Example!

看到这个工作小提琴示例!

#ParentDIV {
    position: relative;
}

#2


0  

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;
}