# How to implement drag and drop

**URL:** <https://www.ruby-forum.com/t/how-to-implement-drag-and-drop/156024>\
**Category:** Ruby\
**Created:** [December 19, 2008, 12:31pm UTC](https://www.ruby-forum.com/t/how-to-implement-drag-and-drop/156024 "2008-12-19T12:31:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arati](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@arati](https://www.ruby-forum.com/u/arati)\
**Post date:** [December 19, 2008, 12:31pm UTC](https://www.ruby-forum.com/t/how-to-implement-drag-and-drop/156024/1 "2008-12-19T12:31:38Z")

</div>

Hi,

I have a set of draggable objects inside a span. I tried to implement  
drag n drop using win32ole library. I used ‘’ function. This funtion  
requires x and y coordinates of soucre and destination. I was sucessfuly  
able to implement drag and drop but with harded x and y coordinates of  
source and destination.

I am reseaching on how to get elements (div, span) x and y coordinates??

Any ideas how can I fix this?

Thanks,  
Arati

---

<div class="post-metadata">

**Author:** ![arati](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@arati](https://www.ruby-forum.com/u/arati)\
**Post date:** [December 19, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/how-to-implement-drag-and-drop/156024/2 "2008-12-19T12:37:50Z")

</div>

Arati Sawant wrote:

> Hi,
> 
> I have a set of draggable objects inside a span. I tried to implement  
> drag n drop using win32ole library. I used ‘’ function. This funtion  
> requires x and y coordinates of soucre and destination. I was sucessfuly  
> able to implement drag and drop but with harded x and y coordinates of  
> source and destination.
> 
> I am reseaching on how to get elements (div, span) x and y coordinates??
> 
> Any ideas how can I fix this?
> 
> Thanks,  
> Arati

Forgot to mentioned the function name ‘MouseClickDrag’.

---

<div class="post-metadata">

**Author:** ![arati](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a87d85/32.png) [@arati](https://www.ruby-forum.com/u/arati)\
**Post date:** [December 19, 2008, 3:57pm UTC](https://www.ruby-forum.com/t/how-to-implement-drag-and-drop/156024/3 "2008-12-19T15:57:30Z")

</div>

Arati Sawant wrote:

> Arati Sawant wrote:
> 
> > Hi,
> > 
> > I have a set of draggable objects inside a span. I tried to implement  
> > drag n drop using win32ole library. I used ‘’ function. This funtion  
> > requires x and y coordinates of soucre and destination. I was sucessfuly  
> > able to implement drag and drop but with harded x and y coordinates of  
> > source and destination.
> > 
> > I am reseaching on how to get elements (div, span) x and y coordinates??
> > 
> > Any ideas how can I fix this?
> > 
> > Thanks,  
> > Arati
> 
> Forgot to mentioned the function name ‘MouseClickDrag’.

Have a look at jQuery, it has a variety of different plugins for this  
sort of thing.
