Thanks in advance for taking the time to look at my question.
Using jQuery & jQuery UI, I have been trying to drag elements such as a bandage, plaster and puddle of water onto individual elements of a stick man. For example, if the bandage is dropped onto his left arm, the background image of the left arm changes to having a bandage on it.
At one point, my code could drag and drop the first item you selected - which was a start. Now, I've lost that and it is just doing the last element in the list of jQuery, which in this case is dragging the puddle of water onto elements of the stick man.
I have been trying to correct it for hours now and can't solve the problem!!
If anyone could help it would be appreciated.
$(document).ready(function () {
//Drag bandage
$(".draggableBandage").draggable({ containment: ".scenarioSec", cursor: "pointer", helper: "clone" });
//Drop bandage on right arm
$("#droppableRightArm").droppable({
drop: function (event, ui) {
$(this).addClass("rpRightArmBandage")
}
});
//Drop bandage on right leg
$("#droppableRightLeg").droppable({
drop: function (event, ui) {
$(this).addClass("rpRightLegBandage")
}
});
//Drop bandage on head
$("#droppableHead").droppable({
drop: function (event, ui) {
$(this).addClass("rpHeadBandage")
}
});
//Drop bandage on left arm
$("#droppableLeftArm").droppable({
drop: function (event, ui) {
$(this).addClass("rpLeftArmBandage")
}
});
//Drop bandage on left leg
$("#droppableLeftLeg").droppable({
drop: function (event, ui) {
$(this).addClass("rpLeftLegBandage")
}
});
});
$(document).ready(function () {
//Drag plaster
$(".draggablePlaster").draggable({ containment: ".scenarioSec", cursor: "pointer", helper: "clone" });
//Drop plaster on right arm
$("#droppableRightArm").droppable({
drop: function (event, ui) {
$(this).addClass("rpRightArmPlaster")
}
});
//Drop plaster on right leg
$("#droppableRightLeg").droppable({
drop: function (event, ui) {
$(this).addClass("rpRightLegPlaster")
}
});
//Drop plaster on head
$("#droppableHead").droppable({
drop: function (event, ui) {
$(this).addClass("rpHeadPlaster")
}
});
//Drop plaster on left arm
$("#droppableLeftArm").droppable({
drop: function (event, ui) {
$(this).addClass("rpLeftArmPlaster")
}
});
//Drop plaster on left leg
$("#droppableLeftLeg").droppable({
drop: function (event, ui) {
$(this).addClass("rpLeftLegPlaster")
}
});
});
$(document).ready(function () {
//Drag water
$(".draggableWater").draggable({ containment: ".scenarioSec", cursor: "pointer", helper: "clone" });
//Drop water on right arm
$("#droppableRightArm").droppable({
drop: function (event, ui) {
$(this).addClass("rpRightArmWater")
}
});
//Drop water on right leg
$("#droppableRightLeg").droppable({
drop: function (event, ui) {
$(this).addClass("rpRightLegWater")
}
});
//Drop water on head
$("#droppableHead").droppable({
drop: function (event, ui) {
$(this).addClass("rpHeadWater")
}
});
//Drop water on left arm
$("#droppableLeftArm").droppable({
drop: function (event, ui) {
$(this).addClass("rpLeftArmWater")
}
});
//Drop water on left leg
$("#droppableLeftLeg").droppable({
drop: function (event, ui) {
$(this).addClass("rpLeftLegWater")
}
});
});