Meg Lepett
Meg Lepett

Reputation: 71

Jquery sortable, how to disable drag and drop

<ul id="box">
<li id="1">1</li>
<li id="2">2</li>
</ul>



$("#box").sortable({ update: function() {
    var order = $("#box").sortable("serialize");
    alert(order);
  }
});                                         

I would like to control the order by pressing buttons, and disable the drag and drop. Everything works great but i could not figure out how to disable the drag and drop but still remain this list sortable?

Edit -

Ok now i start to understand this. I do not need to use sortable at all. How to get the same result in order variable without using sortable?

Upvotes: 0

Views: 725

Answers (1)

Starx
Starx

Reputation: 78961

On that case, you don't need sortable at all. Just use .append() and .prepend() to shift the position.

$("#link-left").click(function() {
   $("#placetoshift").append($("#thesortablediv"));
});

Upvotes: 1

Related Questions