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; }
}
});
精彩评论