desandro / draggabilly

:point_down: Make that shiz draggable

Home Page:https://draggabilly.desandro.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binding two elements

OlegShklyarov opened this issue · comments

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>

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',
};