jquery draggable: how to limit the draggable area?

后端 未结 5 2082
独厮守ぢ
独厮守ぢ 2020-12-01 04:58

I have a draggable object (div), and some droppable ones (table TD\'s). I want the user to drag my draggable object to one of those droppable TD\'s.

I enable draggab

5条回答
  •  -上瘾入骨i
    2020-12-01 05:32

    $(function() { $( "#draggable" ).draggable({ containment: "window" }); });
    

    of this code does not display. Full code and Demo: http://www.limitsizbilgi.com/div-tasima-surukle-birak-div-drag-and-drop-jquery.html

    In order to limit the element inside its parent:

    $( "#draggable" ).draggable({ containment: "window" });
    

提交回复
热议问题