From 910dd9e43c0bc419f37162a668c779d35a341995 Mon Sep 17 00:00:00 2001 From: Illia Sopov Date: Mon, 12 Mar 2018 12:31:30 +0200 Subject: [PATCH] class that indicates state was added this class allows to apply custom styling - 'grab' and 'grabbing' cursor for example --- dragscroll.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dragscroll.js b/dragscroll.js index fd1cf8f..a9d2e93 100644 --- a/dragscroll.js +++ b/dragscroll.js @@ -43,6 +43,7 @@ (cont = el.container || el)[addEventListener]( mousedown, cont.md = function(e) { + el.classList.add('dragging'); if (!el.hasAttribute('nochilddrag') || _document.elementFromPoint( e.pageX, e.pageY @@ -58,7 +59,10 @@ ); _window[addEventListener]( - mouseup, cont.mu = function() {pushed = 0;}, 0 + mouseup, cont.mu = function() { + el.classList.remove('dragging'); + pushed = 0; + }, 0 ); _window[addEventListener](