How can the axis be set depending it’s draggable direction (after init)?
If it’s dragged left-right it will be x, y if dragged up-down.
$("#belt").draggable({
handle: "li",
axis: "y",
start: function() {
//I want to be dragged in the axis i belong which should be x....
},
});
You use distance to constrain the motion initially to get the initial read of which direction the user is moving and then set the axis limitation.
Here’s a fiddle: http://jsfiddle.net/jhchen/B7J2E/