EasyUI Forum
May 10, 2024, 01:26:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to get x,y of mouse in onDrop event ,please?  (Read 7013 times)
zzdfc
Jr. Member
**
Posts: 58


View Profile
« 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= Huh??

    }
});
« Last Edit: June 21, 2015, 09:11:49 AM by zzdfc » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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;
    }
});
Logged
zzdfc
Jr. Member
**
Posts: 58


View Profile
« Reply #2 on: June 22, 2015, 05:35:41 AM »

Good, It's ok,thanks!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!