[英]How to make an item revert back to its original position on drag?
So far I've got this: 到目前为止,我已经知道了:
$(function() {
$("#draggable").draggable({
drag: function(event, ui) {
$(this)
.addClass("choppedonion")
.find("section")
.html("");
}
});
});
But I would also like it to revert back to its original position when dragged. 但是,我也希望它在拖动时恢复到其原始位置。
The jQueryUI sites give you an example of that: http://jqueryui.com/draggable/#revert jQueryUI网站为您提供了一个示例: http : //jqueryui.com/draggable/#revert
Just set the revert option to true: 只需将revert选项设置为true即可:
$('#draggable').draggable({
revert: true,
drag: function() {},
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.