How to disable "snap to grid" from jQuery UI draggable?

1.3k Views Asked by At

Anyone know how we can disable "Snap to Grid" from jQuery UI Draggable base on checkbox.

I m using below code to enable snap to grid dynamically.

$(".WidgetCl").draggable({containment: '#editorWindow',scroll: true, snap: ".gridCol", snapMode: "both", stop :function() {$(this).trigger("stopdrag");}})
            $(".WidgetCl").draggable("option", "grid", [ gridSize, gridSize ]);

Thanks, Sonal

1

There are 1 best solutions below

1
On BEST ANSWER

You have to set the grid option to false to disable snap-to-grid:

$(".WidgetCl").draggable("option", "grid", false);