Cheers for the replies guys, I did what Thomas suggested and I'm slowly
making progress. I have noticed the draggable effects are not as smooth
as I would have hoped. I suspect this is due to the 300+ listening
Droppables.
<script type="text/javascript">
<!-- Assign all game pieces draggable -->
document.getElementsByClassName('game_pieces').each(
function(piece)
{
new Draggable(piece, { revert: true });
}
);
<!-- Assign all board positions droppable -->
document.getElementsByClassName('board_position').each(
function(position)
{
Droppables.add(position, {
accept:'game_pieces',
onDrop:function(element){
new Ajax.Updater(position, '/main/move', {
onLoading:function(request){
Element.show('indicator')
},
onComplete:function(request){
Element.hide('indicator')
},
parameters:'id=' + encodeURIComponent(element.id),
evalScripts:true, asynchronous:true
})
},
hoverclass:'position_active'
})
}
);
</script>
Any opinions on this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---