Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery更改ui包装器位置_Jquery_Jquery Ui_Draggable - Fatal编程技术网

jQuery更改ui包装器位置

jQuery更改ui包装器位置,jquery,jquery-ui,draggable,Jquery,Jquery Ui,Draggable,大家好,进入我的网站,我想让一个元素拖拽和调整大小。 出于某种原因,我希望将元素放置在div父级中的某个位置。 但我无法移动包含从另一个要拖动的图像克隆的图像的ui包装器。 始终: 我已尝试使用此模式: newDiv = $(this).clone().appendTo('#space-drawable-div').resizable({ aspectRatio: true, maxWidth: 212, maxHeight: 220 }).parent('.ui-wra

大家好,进入我的网站,我想让一个元素拖拽和调整大小。 出于某种原因,我希望将元素放置在div父级中的某个位置。 但我无法移动包含从另一个要拖动的图像克隆的图像的ui包装器。 始终:

我已尝试使用此模式:

newDiv = $(this).clone().appendTo('#space-drawable-div').resizable({
    aspectRatio: true,
    maxWidth: 212,
    maxHeight: 220
}).parent('.ui-wrapper').draggable({
    containment: "parent"
}).parent().removeAttr('style').css('top', '10px').css('left', '20px');
我有一个图像,它的父对象是“ui包装器”

ui包装css:

height: 220px;
left: auto;
margin: 0;
overflow: hidden;
position: relative;
top: auto;
width: 157px;

设置css
位置
应该可以解决问题

newDiv = $(this).clone().appendTo('#space-drawable-div').resizable({
aspectRatio: true,
maxWidth: 212,
maxHeight: 220
}).parent('.ui-wrapper').draggable({
containment: "parent"
}).parent().removeAttr('style').css('top', '10px').css('left', '20px').css('position','relative');

你为什么不直接用jQuery的
.css()
来做这个呢?.css('left','20px')我用它@PhillipOk。。。我指的是整个过程。你能发布HTML和更多的CSS吗?
newDiv = $(this).clone().appendTo('#space-drawable-div').resizable({
aspectRatio: true,
maxWidth: 212,
maxHeight: 220
}).parent('.ui-wrapper').draggable({
containment: "parent"
}).parent().removeAttr('style').css('top', '10px').css('left', '20px').css('position','relative');