From 08c31fc0bba9509280f2f3847ab47bee2ea9bab9 Mon Sep 17 00:00:00 2001 From: RubaXa Date: Thu, 7 May 2015 23:14:18 +0300 Subject: [PATCH] #379: + 'delay' description --- README.md | 12 +++++++++++- Sortable.js | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a935ba4..4da1a55 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ You can use any element for the list and its elements, not just `ul`/`li`. Here var sortable = new Sortable(el, { group: "name", // or { name: "...", pull: [true, false, clone], put: [true, false, array] } sort: true, // sorting inside list + delay: 0, // time in milliseconds to define when the sorting should start disabled: false, // Disables the sortable if set to true. store: null, // @see Store animation: 150, // ms, animation speed moving items when sorting, `0` — without animation @@ -140,7 +141,7 @@ You can also define whether lists can give away, give and keep a copy (`clone`), #### `sort` option -Sorting inside list +Sorting inside list. Demo: http://jsbin.com/xizeh/2/edit?html,js,output @@ -148,6 +149,15 @@ Demo: http://jsbin.com/xizeh/2/edit?html,js,output --- +#### `delay` option +time in milliseconds to define when the sorting should start. + +Demo: http://jsbin.com/xizeh/4/edit?html,js,output + + +--- + + #### `disabled` options Disables the sortable if set to `true`. diff --git a/Sortable.js b/Sortable.js index 6de4e05..c4ab166 100644 --- a/Sortable.js +++ b/Sortable.js @@ -1035,7 +1035,9 @@ /** @returns {HTMLElement|false} */ function _ghostInBottom(el, evt) { - var lastEl = el.lastElementChild, rect = lastEl.getBoundingClientRect(); + var lastEl = el.lastElementChild, + rect = lastEl.getBoundingClientRect(); + return (evt.clientY - (rect.top + rect.height) > 5) && lastEl; // min delta }