Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery sortable on a specific area

Tags:

jquery

How do I set the $().sortable(); to a specific area to drag the entire object on? For instance, i want the user to only drag the object by holding on the area of the object.

this is my JS:

$('ul.droptrue').sortable({
            connectWith: 'ul'
});

here's my html

<ul class="droptrue">
   <li>
       <span>Title</span>
       <div>Body</div>
   </li>
</ul>
like image 603
Martin Ongtangco Avatar asked Dec 03 '25 05:12

Martin Ongtangco


1 Answers

Like this:

$('ul.droptrue').sortable({
    connectWith: 'ul',
    handle: 'span'
});

You should read the documentation.

like image 115
SLaks Avatar answered Dec 04 '25 19:12

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!