I have set of divs built in php based on the data I load in, and I use sortable for the users to be able to change to order and save it. To make it more comfortable to use I'd like every second div in set to be of different format. This code works when I move one "even" div to another "even" position, otherwise when I place "even" div to where "odd" one is it starts to color all between them as "odd".
Code:
$( ".droppable" ).sortable({
update: function( ) {
$(".draggable:nth-child(even)").addClass("even");
$(".draggable:nth-child(odd)").addClass("odd");
}
});
What do I do wrong? Cheers for help!