Handling DOM event on element not on top

D

Daniel Kraft

Hi,

I'm trying to implement this: I've got a some absolutely positioned
elements in a webpage and want to allow the user to move another element
per Drag & Drop between those. Thus I want to catch mousemove events
and position the object being moved centered at the cursor; and when the
user fires mouseup on one of the target objects, the moved object should
be dropped there.

My problem however is, that I want to position the moved object on top;
but then only this object receives the mouseup and not the target object
below it. Is there a way to work around this or to solve my problem
some other way?

I thought about the possibility to disable event handling on the moved
object entirely (say something like "event masks" to disable catching
mouseup events on it) so that the event would be fired on the element
below it, but there seems to be no such possibility with DOM Events (at
least Level 2 I've looked at).

Another thing I tried was catching the event and re-firing it; but as I
don't know which target object the mouse was above on the screen, I
could only fire it on the overall-container object and it seemed not to
be propagated to the right child...

Any suggestions would be very welcome! In theory, I could calculate
which target object to fire the event on; this however is something I
would like to avoid and let the browser do for me just as it would if I
could prevent the event from firing on the moved object on top.

Thanks,
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top