admin管理员组文章数量:1384375
Two divs are present in different containers. I want to move the div1 in container1 while dragging div2 in container2. (the 'left' property should remain same for div1 and div2 at all times)
I am able to individually drag each of them by applying 'draggable' function. Also I am able to move the div2 while movie div1 by assigning the left property of div1 to the left property of div2 while 'draggable stop' function is called. But this happens only when after the drag event is finished.
Is there a way so that the div2 will move together with div1 all the time while dragging div1?
Please refer to the JSFiddle link to understand what I am trying to do : /
Two divs are present in different containers. I want to move the div1 in container1 while dragging div2 in container2. (the 'left' property should remain same for div1 and div2 at all times)
I am able to individually drag each of them by applying 'draggable' function. Also I am able to move the div2 while movie div1 by assigning the left property of div1 to the left property of div2 while 'draggable stop' function is called. But this happens only when after the drag event is finished.
Is there a way so that the div2 will move together with div1 all the time while dragging div1?
Please refer to the JSFiddle link to understand what I am trying to do : http://jsfiddle/37Wkd/16/
Share Improve this question asked Aug 23, 2012 at 20:33 BlackCursorBlackCursor 1,4922 gold badges17 silver badges29 bronze badges2 Answers
Reset to default 6$('#block1').draggable({
axis: 'x',
containment: '#container1',
drag: function(){
$('#block2').css('left',$(this).position().left);
}
});
Doesn't this work?
Using the drag
event: http://jqueryui./demos/draggable/
Try this:
http://jsfiddle/37Wkd/17/
本文标签: javascriptWhile dragging a divmove another div together with the dragged divStack Overflow
版权声明:本文标题:javascript - While dragging a div, move another div together with the dragged div - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744514536a2610080.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论