【发布时间】:2013-05-12 19:01:37
【问题描述】:
使用 jQuery UI 进行一些拖放。我必须判断项目是否被放到了 div 之外,所以我需要停止鼠标的位置,但它并没有按照我希望的方式工作。
这是我目前所拥有的:
function getMouseXY() {
var tempX, tempY;
document.onmouseup = getMouseXY;
function getMouseXY(e) {
tempX = e.pageX
tempY = e.pageY
console.log("last xy: " + [tempX, tempY]);
return [tempY, tempX];
}
}
var currentMousePosition = [];
$(".mcCirc").each(function(index){
$(this).draggable({
revert: "invalid",
stop: function( event, ui) {
currentMousePosition = getMouseXY();
}
});
});
【问题讨论】:
标签: jquery jquery-ui user-interface draggable