Skip to main content

Search and Top Navigation

#14697 open bug ()

Opened October 09, 2015 05:20PM UTC

Last modified October 09, 2015 05:39PM UTC

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.


Attachments (0)
Change History (2)

Changed October 09, 2015 05:25PM UTC by lorymole comment:1

_comment0: Title should read "Draggable drifts OFF axis"1444767040987471

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.


Changed October 09, 2015 05:39PM UTC by scottgonzalez comment:2

component: ui.coreui.draggable
status: newopen
summary: Draggable drifts of axisDraggable drifts off axis