jQuery UI draggable not sticking to grid after scroll -
i'm using jquery ui's draggable functionality using set grid option. grid set use [x: 130, y: 110] constraints, , container grid height overflows own parent, allowing me scroll. when have draggable element, , start dragging it, , scroll bit down in container (while still hanging on draggable element), element no longer sticks grid.
i have made barebone example shows error: you can see error in action in jsfiddle here - try start dragging, , scroll in container. if not enough of explanation; see gif of error here (it should stay in top left corner of grids).
i have tried changing grid [x: 100, y: 100] , makes work in chrome , opera because scroll 100 pixels on each scroll, not firefox , ie since use soft-scroll. have tried "hacking" way through it, , moving element center of nearest grid when dragging done via jquery ui's droppable, did not seem usable solution.
is there way ensure draggable element continue stick grid if scroll down while dragging it?
a small hack on code , working fine.
i have modified code small hack, added last div draggable element, snap parent (overflowcontainer) in case, if scroll container.
$( "#draggable" ).draggable({ containment: '.overflowcontainer', grid:[100,100], refreshpositions: true, scroll: false, snap:".innercontent" }); check complete solution under: https://jsfiddle.net/mayankn/o7ke0plu/3/
Comments
Post a Comment