Opened 7 years ago

Last modified 7 years ago

#14697 open bug

Draggable drifts off axis

Reported by: lorymole Owned by:
Priority: minor Milestone: none
Component: ui.draggable Version: 1.11.3
Keywords: Cc:
Blocked by: Blocking:


Creating a draggable with an axis option ( $( "#divId" ).draggable({axis: 'x'}) ) can cause the draggable element to drift off axis.

For example, suppose one users draggable as the basis for creating a slider. When using certain rem values defining thumb dimensions (and centering the thumb), the thumb will drift off-axis on each drag. These errors accumulate as successive drags are performed.

One possible fix would be to conditionally set top in draggable() _mouseDrag():



add this line if ( o.axis != "x")

this.helper[ 0 ] = + "px";

likewise for axis y and left ...

Fiddle Here:

Buggy behavior shows itself in both Chrome and Firefox.


Change History (2)

comment:1 Changed 7 years ago by lorymole

The left positioning of an x-axis draggable is also calculated incorrectly. This can be observed by creating an x-

axis draggable that is constrained to grid locations.

In the above draggable, the draggable will drift left when dragged (slightly) to the right.


Last edited 7 years ago by lorymole (previous) (diff)

comment:2 Changed 7 years ago by Scott González

Component: ui.coreui.draggable
Status: newopen
Summary: Draggable drifts of axisDraggable drifts off axis
Note: See TracTickets for help on using tickets.