Hi alpineedge3,
First of all, try to use Event.positionX(event) and
Event.positionY(event) instead.
I assume that the chunk of code you gave as an example comes from a
server-side language like php, so I will simplify this with raw
JavaScript.
If you want to get the cursor position, try something like this:
new Draggable('div_id', {
onStart: function(draggable, event) {
alert('before drag:' + Event.positionX(event) + ';' +
Event.positionY(event));
},
onEnd: function(draggable, event) {
alert('after drop:' + Event.positionX(event) + ';' +
Event.positionY(event));
}
});
Here is the online API docs of Prototype to get started with the Event
object: http://www.prototypejs.org/api/event
And the Script.aculo.us documentation for the Draggable class:
http://github.com/madrobby/scriptaculous/wikis/draggable
But if you want to have the position of the draggable object itself,
you may want to proceed differently, using Element#positionedOffset:
http://www.prototypejs.org/api/element/positionedoffset
-Larry
On Sep 8, 8:17 pm, alpineedge3 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I need to record the new position of a dragged div. I know the
> starting position, so my plan is to calculate the change in screen
> cursor positions from drag to drop, and add to the div's position. my
> problem is that window.event.screenX or window.event.screenY are not
> working within the new Draggable() function:
>
> [code]
> echo "new Draggable('$div',{onStart:function()
> {alert(window.event.screenX);},".
> "onEnd:function()
> {stopDragStuff('$div',window.event.screenX,window.event.screenY);}".
> "alert('['+screenx+','+screeny+']');}" .
> "});\n";
> [/code]
>
> in the above caes, the alert doesn't work, the function doesn't work
> and the draggable div doesn't stop moving onrelease. i have to double
> click to get it to drop (and no function works in this case either).
>
> any suggestions?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---