jquery ui - How to change color of parent sortable after it has been dragged -
i'm trying change color of parent sortable list item sortable list. apply change in color (red) after parent has been dragged grey list bottom yellow lists. children li's dragged top grey box remain unaffected. want to indicate li has been dragged top grey box.
i applied toggleclass , css via jquery had no luck. appreciated.
http://jsfiddle.net/equiroga/jkcua/1/
$(function () { $("#sortable1").sortable({ helper: "clone", connectwith: ".sortable",
start: function (event, ui) { $(ui.item).show(); clone = $(ui.item).clone(); before = $(ui.item).prev(); position = $(ui.item).index(); }, beforestop: function (event, ui) { if ($(ui.item).closest('ul#sortable1').length > 0) $(this).sortable('cancel'); }, stop: function (event, ui) { if (position == 0) $("#sortable1").prepend(clone); else before.after(clone); } }); $(".sortable").sortable({connectwith: ".sortable:not('#sortable1')"}); });
please, check http://jsfiddle.net/jkcua/6/
i add:
$("#sortable1>li").eq(position).css('background','red'); on stop event.
Comments
Post a Comment