I have two columns, that are jquery-ui sortable. In the left column are choosen items, in the right are all not choosen. You can move items (li
elements) between both. Each element can be either in the left one or in the right column. The first element in the left column (choosen) is not sortable and cant be moved (name ID). Elements in the left column have different style as elements in the right column, also in the left column each li
element is on self line, but in the right column they are floated.
Here is an image of that:
Everything is working fine, but when user is moving element between columns, I need the element change its style (while is moving = left mouse button is down), when is over left or right column. By changing its style I mean, when f.e. I start to move element Telefón
from left to right, when I will be over right column, this element should change its background color to gray and display not in the whole line, but only in its width and ad versa.
I cant figure out, how this can be done. Thanks.
You can add this to your sortable options:
over: function (event, ui) {
if ($(ui.item).closest("ul").hasClass("interested")) {
$(ui.item).detach().appendTo("#categories-source");
$(ui.item).css("width", "initial");
} else {
$(ui.item).detach().appendTo("#categories-chosen");
$(ui.item).css("width", "210px");
$(ui.item).css("height", "initial");
}
}
It puts dragged element in proper ul
depending if previous one had class interested
.
Update
Also set proper dimensions to the dragged element (because left list is one per line).
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments