Hi everybody!
I have an information label on my google maps application and I would
like to allow people to drag this label onto three different positions
on the map (3 droppable areas). It all works fine but I don't like the
effect that revert does when I change the label from one droppable
area to another.
The basic code of my javascript is:
new Draggable('infoLabel',
{
revert: true,
onStart:
function(element){
dragStart(element)
},
onEnd:
function(element){
hideAllContainers();
}
}
);
function createAllDroppables() {
for (var i = 0; i < infoLabelContainers.length; i++) {
container = infoLabelContainers[i];
Droppables.add(container,
{accept: 'infoLabel',
hoverclass: 'infoLabelContHover',
onDrop:function(objectElement, containerElement){
$('infoLabel').highlight();
dropObject(objectElement, containerElement);
}
});
}
}
function addObjectToContainer(objectElement, containerElement) {
containerElement.insert(objectElement);
}
function dropObject(objectElement, containerElement) {
destroyAllDroppables();
objectElement.droped = true;
objectElement.parentNode.removeChild(objectElement);
addObjectToContainer(objectElement, containerElement);
}
function destroyAllDroppables() {
for (var i = 0; i < infoLabelContainers.length; i++) {
sortedObjectList = infoLabelContainers[i].id
Droppables.remove(sortedObjectList);
}
}
function dragStart(element) {
element.droped = false;
createAllDroppables();
showAllContainers();
}
Then I tried doing this change:
new Draggable('infoLabel',
{
revert: function(element, top_offset, left_offset) {
if(element.droped == true){
return 'failure';
}else{
return true;
}
},
onStart:
function(element){
dragStart(element)
},
onEnd:
function(element){
hideAllContainers();
}
}
);
But then when I change the label from one droppable area to another,
it just disappears!!
Could you give me any idea?
Thank you very much.
Alejo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---