Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery sortable element should move only up-down not left or right

Tags:

I am using jquery sortable function for Li within a Ul tag, when i am dragging and dropping elements within ul, then i wanting that it can not be dragged left or right within ul. it should be dragged only up and down.

like image 271
Anu Avatar asked Oct 13 '11 05:10

Anu


1 Answers

Try this:

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

From the docs:

If defined, the items can be dragged only horizontally or vertically. Possible values:'x', 'y'.

like image 200
Ian Hunter Avatar answered Oct 20 '22 13:10

Ian Hunter