EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: zzdfc on June 21, 2015, 09:06:59 AM



Title: How to get x,y of mouse in onDrop event ,please?
Post by: zzdfc on June 21, 2015, 09:06:59 AM
How to get x,y of mouse in onDrop event ,please?

$('#test').droppable({
    onDrop:function(e,source){
        
        var x= ?????

    }
});


Title: Re: How to get x,y of mouse in onDrop event ,please?
Post by: jarry on June 22, 2015, 04:17:56 AM
A possible way is to store the mouse position information when the 'onDrag' event fires, so you can get it in the 'onDrop' event.

Code:
$('.dragitem').draggable({
    onDrag:function(e){
        this.x = e.pageX;
        this.y = e.pageY;
    }
});
$('#test').droppable({
    onDrop:function(e,source){
        var x = source.x;
        var y = source.y;
    }
});


Title: Re: How to get x,y of mouse in onDrop event ,please?
Post by: zzdfc on June 22, 2015, 05:35:41 AM
Good, It's ok,thanks!