【发布时间】:2013-11-14 07:06:49
【问题描述】:
我想通过单击按钮将一些可拖动对象重置为其原始位置。 我可以移动并找到当前位置。但是如何通过单击“重置”按钮来重置它们?这一切都在一个容器内。 谁能帮帮我?
查看FIDDLE
var coordinates = function(element) {
element = $(element);
var top = element.position().top;
var left = element.position().left;
$('#results').text('X: ' + left + ' ' + ' Y: ' + top);
}
$('#custombox').draggable({ containment: "#containment-wrapper", scroll: false,
start: function() {
coordinates('#custombox');
},
stop: function() {
coordinates('#custombox');
}
});
$('#logo').draggable({ containment: "#containment-wrapper", scroll: false,
start: function() {
coordinates('#logo');
},
stop: function() {
coordinates('#logo');
}
});
$("#logo").resizable({ containment: "#containment-wrapper", scroll: false,maxHeight: 250, maxWidth: 350, minHeight: 50, minWidth: 50 });
【问题讨论】:
-
点击重置时,您是要追溯之前的止损还是直接将位置重置为开始时的第一个位置?
-
到第一个位置。 @Vijeta。
标签: jquery position containers draggable reset