开发者

What is the best way to disable the snapTolerance on the right side and bottom side of a JQuery draggable object (UI 1.7.2)?

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;
>        }
>   ...
>   }
>...
>});

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜