I see 2 parts to this problem:
1. How to figure out that dragging has finished (so that AJAX request
for saving new coordinates can be initiated);
2. How to figure out element position.
If you're using the Scriptaulous Draggable "behavior", result should
look like this:
<script src="javascripts/prototype.js" type="text/javascript"></
script>
<script src="scriptaculous.js?load=effects,dragdrop" type="text/
javascript"></script>
...
<div id="my_element"> ... </div>
...
<script type="text/javascript">
new Draggable(
'my_element',
{
onEnd: function(element,mouse_event){
var position = element.cumulativeOffset();
new Ajax.Request(
'/some/url',
{
parameters: {
id: element.id,
x: position.left,
y: position.top
}
}
);
}
}
);
</script>
p.s. Diodeus suggested a very good solution for the second second part
of the problem too. Quirksmode.com is a great resource.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---