Browse Source

#24: + _ghostInBottom

pull/29/head
RubaXa 11 years ago
parent
commit
06bf388b10
  1. 14
      Sortable.js
  2. 2
      Sortable.min.js

14
Sortable.js

@ -28,6 +28,7 @@
, lastEl
, lastCSS
, lastRect
, activeGroup
@ -279,18 +280,19 @@
, target = _closest(evt.target, this.options.draggable, el)
;
if( el.children.length === 0 || el.children[0] === ghostEl ){
if( el.children.length === 0 || el.children[0] === ghostEl || (el === evt.target) && _ghostInBottom(el, evt) ){
el.appendChild(dragEl);
}
else if( target && target !== dragEl && (target.parentNode[expando] !== void 0) ){
if( lastEl !== target ){
lastEl = target;
lastCSS = _css(target)
lastCSS = _css(target);
lastRect = target.getBoundingClientRect();
}
var
rect = target.getBoundingClientRect()
rect = lastRect
, width = rect.right - rect.left
, height = rect.bottom - rect.top
, floating = /left|right|inline/.test(lastCSS.cssFloat + lastCSS.display)
@ -508,6 +510,12 @@
}
function _ghostInBottom(el, evt){
var last = el.lastElementChild.getBoundingClientRect();
return evt.clientY - (last.top + last.height) > 5; // min delta
}
// Export utils
Sortable.utils = {

2
Sortable.min.js vendored

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