views:

2

answers:

0

What I would like to do is disable the snapTolerance the right and bottom sides of a JQuery draggable object. The following code seems to control the snapTolerance of draggable objects when I set snapMode to 'inner'.

My initial thought is to override this portion of the code somehow but, I don't know how to do the override. Or, perhaps, there's a better approach?

TIA


>$.ui.plugin.add("draggable", "snap", {
>    ...
>    drag: function(event, ui) {
>       ...
>       if(o.snapMode != 'outer') {
>          var ts = Math.abs(t - y1) 
>          var bs = Math.abs(b - y2) 
>          var ls = Math.abs(l - x1) 
>          var rs = Math.abs(r - x2) 
>          if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
>          if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
>          if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
>          if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
>        }
>   ...
>   }
>...
>});