[jQuery] Interface drag-drop: More than one draggables and more than one droppables problem.

[jQuery] Interface drag-drop: More than one draggables and more than one droppables problem.


I want to highlight valid moves for dragging square in a chess board.
In the chessboard initial position
Square f3 droppable by pawn on the f2 and knight on the g1.
Because I am setting for square f3 two accept class but working only one.
can I set square.Droppable (
{ accept : validmoveclassesArray,.............
One square can acceptable more than one piece and one piece can movable a
lot of square.
_________________________________________________________________________________________________________________________
var DrawBoard = function()
{
if (model == null) { return; }
    var handle = null;
    var board = $("#Board");
        
// loop through the squares and draw all the pieces
for (piecePos = 0; piecePos < Board.SquareNo; piecePos++)
{
if (model[piecePos] != null)
{
        handle = "#Board > #" + Utils.GetNotation(piecePos);
        var img = $(" ")
img.appendTo(handle);
                img.Draggable(
                 {    
                 ghosting:    true,
                 opacity:    0.5,
                 fx:        300,
                 containment : [board.css("top"), board.css("left"),
board.css("width"), board.css("height")]
                 }
                );
SetUpValidDroppables(piecePos)
}
}
}

var SetUpValidDroppables = function(position)
{
var move;
for(var squareIndex = 0; squareIndex < Board.SquareNo;
squareIndex++)
{
move = model.GetMove(position, squareIndex, null);
if (move != null)
{
        var square = $("#" + Utils.GetNotation(squareIndex));
square.Droppable
(
{
accept :    'piece' + position,
activeclass:    'dropactive',
hoverclass:    'drophover',
tolerance:    'pointer',
fit: true,
onDrop: function(drag)
{
alert(this.outerHTML + "\n\n" +
drag.parentNode.outerHTML )
}
}
);
}
}
}
--
View this message in context: http://www.nabble.com/Interface-drag-drop%3A-More-than-one-draggables-and-more-than-one-droppables-problem.-tf3238003.html#a8999806
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/