Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI Sortable - Disable sideways movement

With the jQuery UI's sortable function, a user can move the div in any direction. I only want the user to be able to drag it up and down. How would I go about doing this?

Thanks in advance.

like image 355
Harry Avatar asked Mar 26 '13 20:03

Harry


Video Answer


2 Answers

Specific to sortable:

http://api.jqueryui.com/sortable/#option-axis

$( ".selector" ).sortable({ axis: "y" });

like image 184
Jake Zeitz Avatar answered Oct 20 '22 20:10

Jake Zeitz


Try something like this:

$('#items_wrapper').sortable({
    axis: 'y',
    containment: 'parent',
     ...
     ...
like image 21
Jesse Avatar answered Oct 20 '22 18:10

Jesse