开发者

Is there any way in jQuery draggable drag event to override the top/left position?

What I am attempting to do is enforce my own boundaries since the draggable extension doesnt have the same sort of boundary logic that I need. So i am try开发者_StackOverflow中文版ing to find a way to override the top/left position of the object being dragged if it goes outside of the bounds I enforce. Any ideas?


$(this).draggable({
  drag: function(event, ui) {
    if(ui.position.top>0) { ui.position.top = 0; }
    if(ui.position.left>0) { ui.position.left = 0; }
  }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜