我想通过单击按钮将一些可拖动对象重置为其原始位置。我可以移动并找到当前位置。但是如何通过单击“重置”按钮来重置它们?这一切都在一个容器内。谁能帮我?
检查这个小提琴
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 });