views:

8

answers:

1

Hi all

I could move an object using jquery ui draggable, but I only want to move the object in x axis, now it moves on both x and y axis

Thank you

+1  A: 

The docs:

Constrains dragging to either the horizontal (x) or vertical (y) axis. Possible values: 'x', 'y'. Code examples

Initialize a draggable with the axis option specified.

$( ".selector" ).draggable({ axis: 'x' });

Get or set the axis option, after init.

//getter
var axis = $( ".selector" ).draggable( "option", "axis" );
//setter
$( ".selector" ).draggable( "option", "axis", 'x' );
g.d.d.c
Thank you, it will help me
milan