Skip to content

Commit

Permalink
Add a class 'dragging' to disable click event when dragging has trigg…
Browse files Browse the repository at this point in the history
…ered.
  • Loading branch information
jtanaka committed Feb 6, 2018
1 parent bb4cd42 commit e22ad32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dragscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@
);

_window[addEventListener](
mouseup, cont.mu = function() {pushed = 0;}, 0
mouseup, cont.mu = function() {pushed = 0;
setTimeout(function(){ el.classList.remove("dragging"); }, 100);
}, 0
);

_window[addEventListener](
mousemove,
cont.mm = function(e) {
if (pushed) {
el.classList.add("dragging");
(scroller = el.scroller||el).scrollLeft -=
newScrollX = (- lastClientX + (lastClientX=e.clientX));
scroller.scrollTop -=
Expand Down

0 comments on commit e22ad32

Please sign in to comment.