Hi
I am wondering if anybody can help.
I already placed a drag and drop on my page, at present the latest
drop is placed over the last one. however i would like the drop area
to only accept one drop and any previous drop is overwritten and
returned to its original position in the draggable class .
below is my code.
window.onload = function() {
// Make all the images draggables from draggables division.
$A($('draganddrop').getElementsByTagName('img')).each(
function(item) {
new Draggable(
item,
{
revert: true,
ghosting: true,
}
);
}
);
Droppables.add(
'dropgame',
{
hoverclass: 'hoverActive',
accept: 'drp',
onDrop: moveItem
}
);
// Set drop area by default non cleared.
$('dropgame').cleared = false;
}
// The target drop area contains a snippet of instructional
// text that we want to remove when the first item
// is dropped into it.
function moveItem( draggable,dropgame){
if (!dropgame.cleared) {
dropgame.innerHTML = '';
dropgame.cleared = true;
$(draggable).morph('width:64px; height:90px;');
}
draggable.parentNode.removeChild(draggable);
dropgame.appendChild(draggable);
$(draggable).morph('width:64px; height:90px;');
}
I thank you in advance for any help and advice :)
--
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.