javascript - Drag child and parent together -
i've got div structure below.
<div id="wrapper"> <div id="innerwrapper"> <div id="obj"></div> </div> </div>
currently i'm using jquery's draggable move div around.
jquery('#obj').draggable();
now i'm in situation need drag #wrapper
dragging #obj
. how can this? want able drag #obj
, drag #wrapper
together.
when this
jquery('#wrapper').draggable();
it not respond on touch devices maybe because #obj
overlapping #wrapper
you can use handle option in draggable ui allow restrict parent getting dragged unless mousedown occurs on specified element(s) in child.
for code can do:
jquery( "#wrapper" ).draggable({ handle: "div#obj" });
for code reference : http://jsfiddle.net/xbb5x/8862/
for library reference: http://jqueryui.com/draggable/#handle
Comments
Post a Comment