Browse Source

Merge pull request #47 from ziflex/master

Added option to handle disabling draggable.
pull/51/head
Lebedev Konstantin 11 years ago
parent
commit
94f89477cd
  1. 9
      Sortable.js
  2. 3
      Sortable.min.js

9
Sortable.js

@ -74,6 +74,7 @@
options.handle = options.handle || null; options.handle = options.handle || null;
options.draggable = options.draggable || el.children[0] && el.children[0].nodeName || (/[uo]l/i.test(el.nodeName) ? 'li' : '*'); options.draggable = options.draggable || el.children[0] && el.children[0].nodeName || (/[uo]l/i.test(el.nodeName) ? 'li' : '*');
options.ghostClass = options.ghostClass || 'sortable-ghost'; options.ghostClass = options.ghostClass || 'sortable-ghost';
options.ignore = options.ignore || 'a, img';
options.onAdd = _bind(this, options.onAdd || noop); options.onAdd = _bind(this, options.onAdd || noop);
options.onUpdate = _bind(this, options.onUpdate || noop); options.onUpdate = _bind(this, options.onUpdate || noop);
@ -142,11 +143,10 @@
tapEvt = evt; tapEvt = evt;
target.draggable = true; target.draggable = true;
// Disable "draggable" // Disable "draggable"
_find(target, 'a', _disableDraggable); Array.prototype.forEach.call(options.ignore.split(','), function (criteria) {
_find(target, 'img', _disableDraggable); _find(target, criteria.trim(), _disableDraggable);
});
if( touch ){ if( touch ){
// Touch device support // Touch device support
@ -410,7 +410,6 @@
} }
}; };
function _bind(ctx, fn){ function _bind(ctx, fn){
var args = slice.call(arguments, 2); var args = slice.call(arguments, 2);
return fn.bind ? fn.bind.apply(fn, [ctx].concat(args)) : function (){ return fn.bind ? fn.bind.apply(fn, [ctx].concat(args)) : function (){

3
Sortable.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save