You want a hit test. This will compare the position of two rectangles (in
your case) and say whether they overlap or not. Here's a simple one:

// given two rectangles: r1, r2
// x1, y1 is upper-left corner; x2, y2 is lower-right
var hit = ( !(r1.x1 > r2.x2 || r1.x2 < r2.x1 || r1.y1 > r2.y2 || r1.y2 <
r2.y1) );

- Richard

On Dec 11, 2007 6:03 AM, Siemen Baader <[EMAIL PROTECTED]> wrote:

>
> Hi group,
>
> is there a way to detect if a draggable element is outside a given DOM
> object when released? I have some markers (divs) on a picture that I
> want to remove when they are dragged off the picture..
>
> I've tried to search the list and on google, but I probably can't come
> up with the right keywords for it... 'element inside' and similar give
> me hits about the structure of the DOM, not the visual appearence of
> the elements.
>
> tx,
> Siemen
>

Reply via email to