1

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

Sonal Khunt
  • 1,876
  • 12
  • 20

1 Answers1

2

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

$(".WidgetCl").draggable("option", "grid", false);
Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
  • Thank You.. Its working.. But it require "snap: false" also. Like $(".WidgetCl").draggable({containment: '#editorWindow',scroll: true, snap: false, snapMode: "both", stop :function() {$(this).trigger("stopdrag");}}) – Sonal Khunt Oct 02 '13 at 10:41