I have 3 draggables and I want them to fit in one droppable each, when they have all been dropped I'd like to do something... I don't know if this code is very good but I don't know how to do it in any other way. Now I wonder if anyone can help me... Guess you can see that I'm very new to this, here is my .js Should I make some kind of array to count the droppables?
$(function(){
$("#dragItems img").draggable({
containment: "#gameBoard",
revert: "invalid"
});
var i = 0;
$(function(){
if(i === 2){
//do something;
} else {
$("#dropBoxes img#drop4").droppable( {
tolerance : "intersect",
accept : "img#drag4",
drop : function() {
$(this).append("<embed src='button-1.wav' autostart='true' hidden='true' loop='false'>");
i++;
}
});
$("#dropBoxes img#drop5").droppable( {
tolerance : "intersect",
accept : "img#drag5",
drop : function() {
$(this).append("<embed src='button-1.wav' autostart='true' hidden='true' loop='false'>");
i++;
}
});
$("#dropBoxes img#drop2").droppable( {
tolerance : "intersect",
accept : "img#drag2",
drop : function() {
$(this).append("<embed src='button-1.wav' autostart='true' hidden='true' loop='false'>");
i++;
}
});
}
});
});