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'})
$( "开发者_JAVA百科#sortable" ).disableSelection();
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.
精彩评论