Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/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 用保证金还原可拖动项目的位置_Jquery_Jquery Ui - Fatal编程技术网

Jquery 用保证金还原可拖动项目的位置

Jquery 用保证金还原可拖动项目的位置,jquery,jquery-ui,Jquery,Jquery Ui,我为我的问题设计了一把简化的小提琴。拖动项目时,它会恢复到由边距引起的错误位置。我如何解决这个问题 HTML: JS: PS:对不起,我不知道如何设置代码的样式。放弃cursorAt选项,对拖动辅助对象应用相同的边距 #image, .ui-draggable { cursor: move; margin-top: 50px; } #image{ cursor: move; margin-top: 50px; } $('#image').draggable

我为我的问题设计了一把简化的小提琴。拖动项目时,它会恢复到由边距引起的错误位置。我如何解决这个问题

HTML:

JS:


PS:对不起,我不知道如何设置代码的样式。

放弃cursorAt选项,对拖动辅助对象应用相同的边距

#image, .ui-draggable {
    cursor: move;
    margin-top: 50px;
}
#image{
    cursor: move; 
    margin-top: 50px;
}
$('#image').draggable({
    revert: true,
    helper:'clone',
    cursorAt: { 
        top: -40
    },
});
#image, .ui-draggable {
    cursor: move;
    margin-top: 50px;
}