Reputation: 5622
I am dragging a div within a main div with respect to y-axis.
$("#childdiv").draggable({axis:'y'});
It drags smoothly in y axis. But I want a drag with jerks..
For Example : When I start drag .. the draggable component directly moves to 50px and if I again drag next jump will be to 100px next drag will directly jump to 150px . It should be simillar like sortable with placeholder but using draggable.
Upvotes: 0
Views: 710
Reputation: 8205
You can use the grid
option to get this:
Snaps the dragging helper to a grid, every x and y pixels. The array must be of the form [ x, y ].
eg.
$("#childdiv").draggable({
axis:'y',
grid: [0, 50]
});
Here's an example fiddle: https://jsfiddle.net/g1epL4ea/
Upvotes: 1