From 5c426a87de94e89e13a4acb884747e3a2c64868d Mon Sep 17 00:00:00 2001 From: Jonas Zeitler Date: Fri, 20 Nov 2015 10:44:38 +0100 Subject: [PATCH] fix a bug causing wrapped float/flex elements to flicker when sorted --- Sortable.js | 9 ++++++--- index.html | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Sortable.js b/Sortable.js index 7423f7e..cf9ef83 100644 --- a/Sortable.js +++ b/Sortable.js @@ -683,9 +683,12 @@ if (elTop === tgTop) { after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide; - } else { - after = tgTop > elTop; - } + } + else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) { + after = (evt.clientY - targetRect.top) / height > 0.5; + } else { + after = tgTop > elTop; + } } else { after = (nextSibling !== dragEl) && !isLong || halfway && isLong; } diff --git a/index.html b/index.html index c706443..ecc8349 100644 --- a/index.html +++ b/index.html @@ -49,7 +49,7 @@