您好!
我使用Jquery pep进行拖放。
我可以使它可拖动,但我不知道如何获得对象的当前位置..
这是我的代码:
var options = {
cssEaseDuration: 1000
start: function(ev,obj){ $('#title').text('Start!'); },
drag: function(ev,obj){
console.log("we're dragging!");
// **I have to know here the coordinates**
},
rest: function(ev,obj){
console.log("stopped!");
}
};
rectangle.pep(options);
以下是演示页: http://pep.briangonzalez.org/demo
(你可以在这个页面中看到,在Debug模式下,你可以看到坐标 - 右下角 - 但是我无法使用它)
完整信息 http://www.wwvalue.com/web-design/jquery/kinetic-drag-with-jquery-css3-and-html5.html
非常感谢您的帮助!!
答案 0 :(得分:0)
jQuery(document).ready(function(){
$(document).mousemove(function(e){
console.log(e.pageX +', '+ e.pageY);
});
})
答案 1 :(得分:0)
好的,我找到了解决方案,非常简单:
var Drag1 = sym.$("Drag1");
var drag = $(Drag1).position();
console.log('x: ' + drag.left + 'y: ' + drag.top);
非常感谢:)