Binding two elements
OlegShklyarov opened this issue · comments
OlegShklyarov commented
Hello, thank you for your awesome script! I have a question - how to move two separate objects simultaneously? Is there an option to bind several elements?
<h1 class="drag">Text1</h1>
<h1 class="bind">Text1</h1>
David DeSandro commented
Hello! Thanks for your question. The best way to bind two elements to move together is to add them to a parent element, use that as the dragging element, but set the two elements as handles.
See https://draggabilly.desandro.com/#handle
<div class="draggie">
<h1>Text1</h1>
<h1>Text2</h1>
</div>
new Draggabilly( '.draggie', {
handle: 'h1',
};