diff --git a/jquery.mCustomScrollbar.js b/jquery.mCustomScrollbar.js index 5106f9f..0c3cf30 100644 --- a/jquery.mCustomScrollbar.js +++ b/jquery.mCustomScrollbar.js @@ -309,6 +309,12 @@ and dependencies (minified). releaseDraggableSelectors null */ /* + callback used to disable touch event (parameters will be event and coordinates) + option default + ------------------------------------- + disableTouch null + */ + /* auto-update timeout values: integer (milliseconds) */ @@ -1291,8 +1297,11 @@ and dependencies (minified). }); }); } + function isTouchDisabled(e) { + return o.advanced.disableTouch ? o.advanced.disableTouch(e, _coordinates(e)) : false; + } function _onTouchstart(e){ - if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;} + if(!_pointerTouch(e) || touchActive || _coordinates(e)[2] || isTouchDisabled(e)){touchable=0; return;} touchable=1; touchDrag=0; docDrag=0; draggable=1; $this.removeClass("mCS_touch_action"); var offset=mCSB_container.offset(); @@ -1301,7 +1310,7 @@ and dependencies (minified). touchIntent=[_coordinates(e)[0],_coordinates(e)[1]]; } function _onTouchmove(e){ - if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;} + if(!_pointerTouch(e) || touchActive || _coordinates(e)[2] || isTouchDisabled(e)){return;} if(!o.documentTouchScroll){e.preventDefault();} e.stopImmediatePropagation(); if(docDrag && !touchDrag){return;} @@ -1335,7 +1344,7 @@ and dependencies (minified). } } function _onTouchstart2(e){ - if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;} + if(!_pointerTouch(e) || touchActive || _coordinates(e)[2] || isTouchDisabled(e)){touchable=0; return;} touchable=1; e.stopImmediatePropagation(); _stop($this); @@ -1346,7 +1355,7 @@ and dependencies (minified). touchMoveY=[]; touchMoveX=[]; } function _onTouchend(e){ - if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;} + if(!_pointerTouch(e) || touchActive || _coordinates(e)[2] || isTouchDisabled(e)){return;} draggable=0; e.stopImmediatePropagation(); touchDrag=0; docDrag=0; @@ -2422,4 +2431,4 @@ and dependencies (minified). }); -}))})); \ No newline at end of file +}))}));