Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery sortable -- enable sortable only on drag, not click

I have a bunch of divs which have jQuery sortable (as grid) enabled. This is all working fine, but I want to only have sortable enabled when a user drags the div - not when he clicks it. For example, these divs have scrollbars, and whenever you drag the handle, it binds the div to the mouse and forces you to sort it. How do I turn this off?

Here's my jQuery:

$(  "#sortable"  ).sortable({ items: 'li:not(.ui-tabs-nav-item,#newspod,#imglist li)', containment: '#sortable'})

$( "#sortable" ).disableSelection();
like image 433
vandrop Avatar asked Oct 25 '22 03:10

vandrop


1 Answers

You can add this property

distance: 15

to your sortable object so that the user has to drag it 15 pixels before it will activate the sortable behavior.

like image 182
Peter Olson Avatar answered Nov 09 '22 13:11

Peter Olson