Sebastián Grignoli
Sebastián Grignoli

Reputation: 33432

Get the coordinates of a drop event in Javascript?

I made a Javascript library that lets me drag a marker from a dragzone to one or more dropzones.

The problem is... the mouseup event happens over the marker I'm dragging, not the dropzone.

How can I detect in which dropzone was the marker dropped, and in what coordinates?

Here's my script:

http://dl.dropbox.com/u/186012/demos/dragger/drag.html

Upvotes: 4

Views: 784

Answers (2)

bcm
bcm

Reputation: 5500

if having a new instance is the only special thing you need... you can use the jQuery library to clone your initial clicked upon marker, and drag that clone to where you want it to be.

You can also modify the cloned marker's attributes with jQuery depending on your needs.

Upvotes: 1

mP.
mP.

Reputation: 18266

This is not actually a direct answer to your question, but why reinvent a solution to this problem that has already been solved in the many popular and robust javascript libs like JQuery.

Upvotes: 0

Related Questions