I am using jQueryUI sortable, I have two lists:
When dragging from added to removed I want the div .container background colour to change to red.
Then when dragging from removed to added I want the div .containerTwo background colour to change to red.
http://jsfiddle.net/w3vvL/
$("#gallery").sortable({
connectWith: "#trash"
});
$("#trash").sortable({
connectWith: "#gallery"
});
Any ideas? Thanks
You can use the receive event to respond to when the list receives an item:
See the updated fiddle: http://jsfiddle.net/w3vvL/39/
$("#gallery").sortable({
connectWith: "#trash",
receive: function(event, ui) {
$(".container").css("background-color", "red");
}
});
And with animation:
$("#gallery").sortable({
connectWith: "#trash",
receive: function(event, ui) {
$(".container").css("background-color", "green");
$(".container").stop().animate({ backgroundColor: "white" }, "slow");
}
});
See updated fiddle: http://jsfiddle.net/w3vvL/43/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With