views:

113

answers:

1

Hello,

I was experimenting with the onDragEnter event and realized it only works in IE. How can I recreate this event using jQuery, so that I can get information about what is being dragged, etc.?

For example, I'm trying to drag some random text over a box that can recognize what the text is, etc. I also need to be able to drag some random image and have the same box recognize what the image is, etc.

Any help would be greatly appreciated.

Regards, David

A: 

I imagine someone has wrapped this into a nice event model already, but I don't know of it, so here's one option:

During drag (after dragstart and before dragstop) you should be able to attach an event handler to onmousemove. That will fire pretty much continuously as the element is being dragged, and you can run basic dimensional math to detect whether the mouse or the dragged element(s) have intersected with any of your potential target elements, and fire your own event then.

Rex M
Hey Rex,Thank you very much for the response. I've just started dabbling in Javascript so please pardon the questions.How do I attach an event handler to onmousemove during drag? And how can I make sure I can specifically reference the content that is being dragged (be it text, images, or text and images)?Thank you,David