Indeed you're using the right callback. Now you might use substract the
droppable's coordinates relative to the document (
http://docs.jquery.com/CSS/offset) to the clientX and clientY and guess what
you'll get ?... Now to know wether you're on the top / bottom | left / right
corner, you may use the droppable's .with() and .height() and compare the
mouse's coordinates.

Michel Belleville


2009/11/5 Steve <sclar...@gmail.com>

> I'm trying to determine where the cursor (while dragging the
> 'draggable' element) falls within the 'droppable' element (top half,
> bottom half, leftside, or rightside?).
>
> I'm trying to use the 'drop' event in the 'droppable' element, but
> don't know how to determine the cursor coordinates relative to the
> droppable element.
>
> My code so far: --- this returns the coordinates absolute to the
> browser's window.  Help?  TIA, Steve
>
> $('div.formRow').droppable({
>        accept:                 '.formRow',
>        tolerance:                      'pointer',
>        over:                           function(){
>                                                $(this).css("border:1px
> solid black");
>                                        },
>        drop:                           function(event){
>                                                var x = event.clientX;
>                                                var y = event.clientY;
>                                                alert("X coords: " + x + ",
> Y coords: " + y);
>                                        },
>        addClasses:             false
> });
>

Reply via email to