Re: How can I get X and Y values.

86 views
Skip to first unread message
Message has been deleted

jlg...@yahoo.fr

unread,
Dec 14, 2011, 6:44:35 PM12/14/11
to threed...@googlegroups.com
Look here: http://threedubmedia.com/code/event/drag#properties

You can use offsetX and offsetY, available as properties of the second argument of your callback function:

$('.drag').drag(function( ev, dd ){
  $( this ).css({
     top: dd.offsetY,
     left: dd.offsetX
  });
  $(this).text("x:" + dd.
offsetX + ", y:" + dd.offsetY);
});

Sarm

unread,
Feb 1, 2012, 5:29:28 AM2/1/12
to threedubmedia
It's giving offset of entire windows. how can i get offset of
container?

Marty Nelson

unread,
Feb 8, 2012, 11:39:01 AM2/8/12
to threed...@googlegroups.com
pass in option relative as true:

.drag(function( ev, dd ){
...
}, { relative: true })

--
You received this message because you are subscribed to the Google Groups "threedubmedia" group.
To post to this group, send email to threed...@googlegroups.com.
To unsubscribe from this group, send email to threedubmedi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/threedubmedia?hl=en.


Reply all
Reply to author
Forward
0 new messages