This is my simplified div structure on which i applied the JQuery UI sortable interaction (see this JS Fiddle example):
<div id="sortable_panels">
<div class="panel" id="panel1">
<div class="header" id="panel1_header">Panel 1 header</div>
<div id="panel1_content"></div>
</div>
<div class="panel" id="panel2">
<div class="header" id="panel2_header">Panel 2 header</div>
<div id="panel2_content"></div>
</div>
<div class="panel" id="panel3">
<div class="header" id="panel3_header">Panel 3 header</div>
<div id="panel3_content"></div>
</div>
<div class="clear"></div>
</div>
I want a panel to be draggable only when I drag the panel headers. Is there a way to accomplish this?
Enable a group of DOM elements to be sortable. Click on and drag an element to a new spot within the list, and the other items will adjust to fit. By default, sortable items share draggable properties.
jQueryUI provides sortable() method to reorder elements in list or grid using the mouse. This method performs sortability action based upon an operation string passed as the first parameter.
You can use . sortable("enable") and . sortable("disable") to toggle the sortable widget on and off.
you can use this option in your sortable interaction
handle:'.header'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With