diff --git a/dist/perfect-scrollbar.common.js b/dist/perfect-scrollbar.common.js index 0eb116860..3e4e41c15 100644 --- a/dist/perfect-scrollbar.common.js +++ b/dist/perfect-scrollbar.common.js @@ -1,6 +1,6 @@ /*! * perfect-scrollbar v1.4.0 - * (c) 2018 Hyunje Jun + * (c) 2019 Hyunje Jun * @license MIT */ 'use strict'; @@ -58,6 +58,7 @@ function queryChildren(element, selector) { var cls = { main: 'ps', + rtl: 'ps__rtl', element: { thumb: function (x) { return ("ps__thumb-" + x); }, rail: function (x) { return ("ps__rail-" + x); }, @@ -310,6 +311,8 @@ var env = { supportsTouch: typeof window !== 'undefined' && ('ontouchstart' in window || + ('maxTouchPoints' in window.navigator && + window.navigator.maxTouchPoints > 0) || (window.DocumentTouch && document instanceof window.DocumentTouch)), supportsIePointer: typeof navigator !== 'undefined' && navigator.msMaxTouchPoints, @@ -323,10 +326,11 @@ var updateGeometry = function(i) { var roundedScrollTop = Math.floor(element.scrollTop); var rect = element.getBoundingClientRect(); + var fixedHeaderFooterHeight = i.settings.getTopOffset() + i.settings.getBottomOffset(); i.containerWidth = Math.ceil(rect.width); - i.containerHeight = Math.ceil(rect.height); + i.containerHeight = Math.ceil(rect.height) - fixedHeaderFooterHeight; i.contentWidth = element.scrollWidth; - i.contentHeight = element.scrollHeight; + i.contentHeight = element.scrollHeight - fixedHeaderFooterHeight; if (!element.contains(i.scrollbarXRail)) { // clean up and append @@ -396,7 +400,7 @@ var updateGeometry = function(i) { element.classList.remove(cls.state.active('x')); i.scrollbarXWidth = 0; i.scrollbarXLeft = 0; - element.scrollLeft = 0; + element.scrollLeft = i.isRtl === true ? i.contentWidth : 0; } if (i.scrollbarYActive) { element.classList.add(cls.state.active('y')); @@ -438,14 +442,15 @@ function updateCss(element, i) { } set(i.scrollbarXRail, xRailOffset); - var yRailOffset = { top: roundedScrollTop, height: i.railYHeight }; + var yRailOffset = { top: roundedScrollTop + i.settings.getTopOffset(), height: i.railYHeight }; if (i.isScrollbarYUsingRight) { if (i.isRtl) { yRailOffset.right = i.contentWidth - (i.negativeScrollAdjustment + element.scrollLeft) - i.scrollbarYRight - - i.scrollbarYOuterWidth; + i.scrollbarYOuterWidth - + 9; } else { yRailOffset.right = i.scrollbarYRight - element.scrollLeft; } @@ -548,6 +553,9 @@ function bindMouseScrollHandler( var scrollBy = null; function mouseMoveHandler(e) { + if (e.touches && e.touches[0]) { + e[pageY] = e.touches[0].pageY; + } element[scrollTop] = startingScrollTop + scrollBy * (e[pageY] - startingMousePageY); addScrollingClass(i, y); @@ -563,20 +571,33 @@ function bindMouseScrollHandler( i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); } - i.event.bind(i[scrollbarY], 'mousedown', function (e) { + function bindMoves(e, touchMode) { startingScrollTop = element[scrollTop]; + if (touchMode && e.touches) { + e[pageY] = e.touches[0].pageY; + } startingMousePageY = e[pageY]; scrollBy = (i[contentHeight] - i[containerHeight]) / (i[railYHeight] - i[scrollbarYHeight]); - - i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); - i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); + if (!touchMode) { + i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); + i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); + e.preventDefault(); + } else { + i.event.bind(i.ownerDocument, 'touchmove', mouseMoveHandler); + } i[scrollbarYRail].classList.add(cls.state.clicking); e.stopPropagation(); - e.preventDefault(); + } + + i.event.bind(i[scrollbarY], 'mousedown', function (e) { + bindMoves(e); + }); + i.event.bind(i[scrollbarY], 'touchstart', function (e) { + bindMoves(e, true); }); } @@ -795,26 +816,26 @@ var wheel = function(i) { } var style = get(cursor); - var overflow = [style.overflow, style.overflowX, style.overflowY].join( - '' - ); - // if scrollable - if (overflow.match(/(scroll|auto)/)) { + // if deltaY && vertical scrollable + if (deltaY && style.overflowY.match(/(scroll|auto)/)) { var maxScrollTop = cursor.scrollHeight - cursor.clientHeight; if (maxScrollTop > 0) { if ( - !(cursor.scrollTop === 0 && deltaY > 0) && - !(cursor.scrollTop === maxScrollTop && deltaY < 0) + (cursor.scrollTop > 0 && deltaY < 0) || + (cursor.scrollTop < maxScrollTop && deltaY > 0) ) { return true; } } + } + // if deltaX && horizontal scrollable + if (deltaX && style.overflowX.match(/(scroll|auto)/)) { var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth; if (maxScrollLeft > 0) { if ( - !(cursor.scrollLeft === 0 && deltaX < 0) && - !(cursor.scrollLeft === maxScrollLeft && deltaX > 0) + (cursor.scrollLeft > 0 && deltaX < 0) || + (cursor.scrollLeft < maxScrollLeft && deltaX > 0) ) { return true; } @@ -983,26 +1004,26 @@ var touch = function(i) { } var style = get(cursor); - var overflow = [style.overflow, style.overflowX, style.overflowY].join( - '' - ); - // if scrollable - if (overflow.match(/(scroll|auto)/)) { + // if deltaY && vertical scrollable + if (deltaY && style.overflowY.match(/(scroll|auto)/)) { var maxScrollTop = cursor.scrollHeight - cursor.clientHeight; if (maxScrollTop > 0) { if ( - !(cursor.scrollTop === 0 && deltaY > 0) && - !(cursor.scrollTop === maxScrollTop && deltaY < 0) + (cursor.scrollTop > 0 && deltaY < 0) || + (cursor.scrollTop < maxScrollTop && deltaY > 0) ) { return true; } } - var maxScrollLeft = cursor.scrollLeft - cursor.clientWidth; + } + // if deltaX && horizontal scrollable + if (deltaX && style.overflowX.match(/(scroll|auto)/)) { + var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth; if (maxScrollLeft > 0) { if ( - !(cursor.scrollLeft === 0 && deltaX < 0) && - !(cursor.scrollLeft === maxScrollLeft && deltaX > 0) + (cursor.scrollLeft > 0 && deltaX < 0) || + (cursor.scrollLeft < maxScrollLeft && deltaX > 0) ) { return true; } @@ -1102,6 +1123,8 @@ var defaultSettings = function () { return ({ useBothWheelAxes: false, wheelPropagation: true, wheelSpeed: 1, + getTopOffset: function () { return 0; }, + getBottomOffset: function () { return 0; }, }); }; var handlers = { @@ -1142,6 +1165,9 @@ var PerfectScrollbar = function PerfectScrollbar(element, userSettings) { var blur = function () { return element.classList.remove(cls.state.focus); }; this.isRtl = get(element).direction === 'rtl'; + if (this.isRtl === true) { + element.classList.add(cls.rtl); + } this.isNegativeScroll = (function () { var originalScrollLeft = element.scrollLeft; var result = null; diff --git a/dist/perfect-scrollbar.esm.js b/dist/perfect-scrollbar.esm.js index 02e5224bf..f6da5cb35 100644 --- a/dist/perfect-scrollbar.esm.js +++ b/dist/perfect-scrollbar.esm.js @@ -1,6 +1,6 @@ /*! * perfect-scrollbar v1.4.0 - * (c) 2018 Hyunje Jun + * (c) 2019 Hyunje Jun * @license MIT */ function get(element) { @@ -56,6 +56,7 @@ function queryChildren(element, selector) { var cls = { main: 'ps', + rtl: 'ps__rtl', element: { thumb: function (x) { return ("ps__thumb-" + x); }, rail: function (x) { return ("ps__rail-" + x); }, @@ -308,6 +309,8 @@ var env = { supportsTouch: typeof window !== 'undefined' && ('ontouchstart' in window || + ('maxTouchPoints' in window.navigator && + window.navigator.maxTouchPoints > 0) || (window.DocumentTouch && document instanceof window.DocumentTouch)), supportsIePointer: typeof navigator !== 'undefined' && navigator.msMaxTouchPoints, @@ -321,10 +324,11 @@ var updateGeometry = function(i) { var roundedScrollTop = Math.floor(element.scrollTop); var rect = element.getBoundingClientRect(); + var fixedHeaderFooterHeight = i.settings.getTopOffset() + i.settings.getBottomOffset(); i.containerWidth = Math.ceil(rect.width); - i.containerHeight = Math.ceil(rect.height); + i.containerHeight = Math.ceil(rect.height) - fixedHeaderFooterHeight; i.contentWidth = element.scrollWidth; - i.contentHeight = element.scrollHeight; + i.contentHeight = element.scrollHeight - fixedHeaderFooterHeight; if (!element.contains(i.scrollbarXRail)) { // clean up and append @@ -394,7 +398,7 @@ var updateGeometry = function(i) { element.classList.remove(cls.state.active('x')); i.scrollbarXWidth = 0; i.scrollbarXLeft = 0; - element.scrollLeft = 0; + element.scrollLeft = i.isRtl === true ? i.contentWidth : 0; } if (i.scrollbarYActive) { element.classList.add(cls.state.active('y')); @@ -436,14 +440,15 @@ function updateCss(element, i) { } set(i.scrollbarXRail, xRailOffset); - var yRailOffset = { top: roundedScrollTop, height: i.railYHeight }; + var yRailOffset = { top: roundedScrollTop + i.settings.getTopOffset(), height: i.railYHeight }; if (i.isScrollbarYUsingRight) { if (i.isRtl) { yRailOffset.right = i.contentWidth - (i.negativeScrollAdjustment + element.scrollLeft) - i.scrollbarYRight - - i.scrollbarYOuterWidth; + i.scrollbarYOuterWidth - + 9; } else { yRailOffset.right = i.scrollbarYRight - element.scrollLeft; } @@ -546,6 +551,9 @@ function bindMouseScrollHandler( var scrollBy = null; function mouseMoveHandler(e) { + if (e.touches && e.touches[0]) { + e[pageY] = e.touches[0].pageY; + } element[scrollTop] = startingScrollTop + scrollBy * (e[pageY] - startingMousePageY); addScrollingClass(i, y); @@ -561,20 +569,33 @@ function bindMouseScrollHandler( i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); } - i.event.bind(i[scrollbarY], 'mousedown', function (e) { + function bindMoves(e, touchMode) { startingScrollTop = element[scrollTop]; + if (touchMode && e.touches) { + e[pageY] = e.touches[0].pageY; + } startingMousePageY = e[pageY]; scrollBy = (i[contentHeight] - i[containerHeight]) / (i[railYHeight] - i[scrollbarYHeight]); - - i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); - i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); + if (!touchMode) { + i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); + i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); + e.preventDefault(); + } else { + i.event.bind(i.ownerDocument, 'touchmove', mouseMoveHandler); + } i[scrollbarYRail].classList.add(cls.state.clicking); e.stopPropagation(); - e.preventDefault(); + } + + i.event.bind(i[scrollbarY], 'mousedown', function (e) { + bindMoves(e); + }); + i.event.bind(i[scrollbarY], 'touchstart', function (e) { + bindMoves(e, true); }); } @@ -793,26 +814,26 @@ var wheel = function(i) { } var style = get(cursor); - var overflow = [style.overflow, style.overflowX, style.overflowY].join( - '' - ); - // if scrollable - if (overflow.match(/(scroll|auto)/)) { + // if deltaY && vertical scrollable + if (deltaY && style.overflowY.match(/(scroll|auto)/)) { var maxScrollTop = cursor.scrollHeight - cursor.clientHeight; if (maxScrollTop > 0) { if ( - !(cursor.scrollTop === 0 && deltaY > 0) && - !(cursor.scrollTop === maxScrollTop && deltaY < 0) + (cursor.scrollTop > 0 && deltaY < 0) || + (cursor.scrollTop < maxScrollTop && deltaY > 0) ) { return true; } } + } + // if deltaX && horizontal scrollable + if (deltaX && style.overflowX.match(/(scroll|auto)/)) { var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth; if (maxScrollLeft > 0) { if ( - !(cursor.scrollLeft === 0 && deltaX < 0) && - !(cursor.scrollLeft === maxScrollLeft && deltaX > 0) + (cursor.scrollLeft > 0 && deltaX < 0) || + (cursor.scrollLeft < maxScrollLeft && deltaX > 0) ) { return true; } @@ -981,26 +1002,26 @@ var touch = function(i) { } var style = get(cursor); - var overflow = [style.overflow, style.overflowX, style.overflowY].join( - '' - ); - // if scrollable - if (overflow.match(/(scroll|auto)/)) { + // if deltaY && vertical scrollable + if (deltaY && style.overflowY.match(/(scroll|auto)/)) { var maxScrollTop = cursor.scrollHeight - cursor.clientHeight; if (maxScrollTop > 0) { if ( - !(cursor.scrollTop === 0 && deltaY > 0) && - !(cursor.scrollTop === maxScrollTop && deltaY < 0) + (cursor.scrollTop > 0 && deltaY < 0) || + (cursor.scrollTop < maxScrollTop && deltaY > 0) ) { return true; } } - var maxScrollLeft = cursor.scrollLeft - cursor.clientWidth; + } + // if deltaX && horizontal scrollable + if (deltaX && style.overflowX.match(/(scroll|auto)/)) { + var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth; if (maxScrollLeft > 0) { if ( - !(cursor.scrollLeft === 0 && deltaX < 0) && - !(cursor.scrollLeft === maxScrollLeft && deltaX > 0) + (cursor.scrollLeft > 0 && deltaX < 0) || + (cursor.scrollLeft < maxScrollLeft && deltaX > 0) ) { return true; } @@ -1100,6 +1121,8 @@ var defaultSettings = function () { return ({ useBothWheelAxes: false, wheelPropagation: true, wheelSpeed: 1, + getTopOffset: function () { return 0; }, + getBottomOffset: function () { return 0; }, }); }; var handlers = { @@ -1140,6 +1163,9 @@ var PerfectScrollbar = function PerfectScrollbar(element, userSettings) { var blur = function () { return element.classList.remove(cls.state.focus); }; this.isRtl = get(element).direction === 'rtl'; + if (this.isRtl === true) { + element.classList.add(cls.rtl); + } this.isNegativeScroll = (function () { var originalScrollLeft = element.scrollLeft; var result = null; diff --git a/dist/perfect-scrollbar.js b/dist/perfect-scrollbar.js index bdc1b178f..ba7e063fe 100644 --- a/dist/perfect-scrollbar.js +++ b/dist/perfect-scrollbar.js @@ -1,6 +1,6 @@ /*! * perfect-scrollbar v1.4.0 - * (c) 2018 Hyunje Jun + * (c) 2019 Hyunje Jun * @license MIT */ (function (global, factory) { @@ -62,6 +62,7 @@ function queryChildren(element, selector) { var cls = { main: 'ps', + rtl: 'ps__rtl', element: { thumb: function (x) { return ("ps__thumb-" + x); }, rail: function (x) { return ("ps__rail-" + x); }, @@ -314,6 +315,8 @@ var env = { supportsTouch: typeof window !== 'undefined' && ('ontouchstart' in window || + ('maxTouchPoints' in window.navigator && + window.navigator.maxTouchPoints > 0) || (window.DocumentTouch && document instanceof window.DocumentTouch)), supportsIePointer: typeof navigator !== 'undefined' && navigator.msMaxTouchPoints, @@ -327,10 +330,11 @@ var updateGeometry = function(i) { var roundedScrollTop = Math.floor(element.scrollTop); var rect = element.getBoundingClientRect(); + var fixedHeaderFooterHeight = i.settings.getTopOffset() + i.settings.getBottomOffset(); i.containerWidth = Math.ceil(rect.width); - i.containerHeight = Math.ceil(rect.height); + i.containerHeight = Math.ceil(rect.height) - fixedHeaderFooterHeight; i.contentWidth = element.scrollWidth; - i.contentHeight = element.scrollHeight; + i.contentHeight = element.scrollHeight - fixedHeaderFooterHeight; if (!element.contains(i.scrollbarXRail)) { // clean up and append @@ -400,7 +404,7 @@ var updateGeometry = function(i) { element.classList.remove(cls.state.active('x')); i.scrollbarXWidth = 0; i.scrollbarXLeft = 0; - element.scrollLeft = 0; + element.scrollLeft = i.isRtl === true ? i.contentWidth : 0; } if (i.scrollbarYActive) { element.classList.add(cls.state.active('y')); @@ -442,14 +446,15 @@ function updateCss(element, i) { } set(i.scrollbarXRail, xRailOffset); - var yRailOffset = { top: roundedScrollTop, height: i.railYHeight }; + var yRailOffset = { top: roundedScrollTop + i.settings.getTopOffset(), height: i.railYHeight }; if (i.isScrollbarYUsingRight) { if (i.isRtl) { yRailOffset.right = i.contentWidth - (i.negativeScrollAdjustment + element.scrollLeft) - i.scrollbarYRight - - i.scrollbarYOuterWidth; + i.scrollbarYOuterWidth - + 9; } else { yRailOffset.right = i.scrollbarYRight - element.scrollLeft; } @@ -552,6 +557,9 @@ function bindMouseScrollHandler( var scrollBy = null; function mouseMoveHandler(e) { + if (e.touches && e.touches[0]) { + e[pageY] = e.touches[0].pageY; + } element[scrollTop] = startingScrollTop + scrollBy * (e[pageY] - startingMousePageY); addScrollingClass(i, y); @@ -567,20 +575,33 @@ function bindMouseScrollHandler( i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler); } - i.event.bind(i[scrollbarY], 'mousedown', function (e) { + function bindMoves(e, touchMode) { startingScrollTop = element[scrollTop]; + if (touchMode && e.touches) { + e[pageY] = e.touches[0].pageY; + } startingMousePageY = e[pageY]; scrollBy = (i[contentHeight] - i[containerHeight]) / (i[railYHeight] - i[scrollbarYHeight]); - - i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); - i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); + if (!touchMode) { + i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler); + i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler); + e.preventDefault(); + } else { + i.event.bind(i.ownerDocument, 'touchmove', mouseMoveHandler); + } i[scrollbarYRail].classList.add(cls.state.clicking); e.stopPropagation(); - e.preventDefault(); + } + + i.event.bind(i[scrollbarY], 'mousedown', function (e) { + bindMoves(e); + }); + i.event.bind(i[scrollbarY], 'touchstart', function (e) { + bindMoves(e, true); }); } @@ -799,26 +820,26 @@ var wheel = function(i) { } var style = get(cursor); - var overflow = [style.overflow, style.overflowX, style.overflowY].join( - '' - ); - // if scrollable - if (overflow.match(/(scroll|auto)/)) { + // if deltaY && vertical scrollable + if (deltaY && style.overflowY.match(/(scroll|auto)/)) { var maxScrollTop = cursor.scrollHeight - cursor.clientHeight; if (maxScrollTop > 0) { if ( - !(cursor.scrollTop === 0 && deltaY > 0) && - !(cursor.scrollTop === maxScrollTop && deltaY < 0) + (cursor.scrollTop > 0 && deltaY < 0) || + (cursor.scrollTop < maxScrollTop && deltaY > 0) ) { return true; } } + } + // if deltaX && horizontal scrollable + if (deltaX && style.overflowX.match(/(scroll|auto)/)) { var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth; if (maxScrollLeft > 0) { if ( - !(cursor.scrollLeft === 0 && deltaX < 0) && - !(cursor.scrollLeft === maxScrollLeft && deltaX > 0) + (cursor.scrollLeft > 0 && deltaX < 0) || + (cursor.scrollLeft < maxScrollLeft && deltaX > 0) ) { return true; } @@ -987,26 +1008,26 @@ var touch = function(i) { } var style = get(cursor); - var overflow = [style.overflow, style.overflowX, style.overflowY].join( - '' - ); - // if scrollable - if (overflow.match(/(scroll|auto)/)) { + // if deltaY && vertical scrollable + if (deltaY && style.overflowY.match(/(scroll|auto)/)) { var maxScrollTop = cursor.scrollHeight - cursor.clientHeight; if (maxScrollTop > 0) { if ( - !(cursor.scrollTop === 0 && deltaY > 0) && - !(cursor.scrollTop === maxScrollTop && deltaY < 0) + (cursor.scrollTop > 0 && deltaY < 0) || + (cursor.scrollTop < maxScrollTop && deltaY > 0) ) { return true; } } - var maxScrollLeft = cursor.scrollLeft - cursor.clientWidth; + } + // if deltaX && horizontal scrollable + if (deltaX && style.overflowX.match(/(scroll|auto)/)) { + var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth; if (maxScrollLeft > 0) { if ( - !(cursor.scrollLeft === 0 && deltaX < 0) && - !(cursor.scrollLeft === maxScrollLeft && deltaX > 0) + (cursor.scrollLeft > 0 && deltaX < 0) || + (cursor.scrollLeft < maxScrollLeft && deltaX > 0) ) { return true; } @@ -1106,6 +1127,8 @@ var defaultSettings = function () { return ({ useBothWheelAxes: false, wheelPropagation: true, wheelSpeed: 1, + getTopOffset: function () { return 0; }, + getBottomOffset: function () { return 0; }, }); }; var handlers = { @@ -1146,6 +1169,9 @@ var PerfectScrollbar = function PerfectScrollbar(element, userSettings) { var blur = function () { return element.classList.remove(cls.state.focus); }; this.isRtl = get(element).direction === 'rtl'; + if (this.isRtl === true) { + element.classList.add(cls.rtl); + } this.isNegativeScroll = (function () { var originalScrollLeft = element.scrollLeft; var result = null; diff --git a/dist/perfect-scrollbar.min.js b/dist/perfect-scrollbar.min.js index a534b3461..17f9190a3 100644 --- a/dist/perfect-scrollbar.min.js +++ b/dist/perfect-scrollbar.min.js @@ -1,6 +1,6 @@ /*! * perfect-scrollbar v1.4.0 - * (c) 2018 Hyunje Jun + * (c) 2019 Hyunje Jun * @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PerfectScrollbar=e()}(this,function(){"use strict";function v(t){return getComputedStyle(t)}function d(t,e){for(var i in e){var l=e[i];"number"==typeof l&&(l+="px"),t.style[i]=l}return t}function f(t){var e=document.createElement("div");return e.className=t,e}var i="undefined"!=typeof Element&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector);function s(t,e){if(!i)throw new Error("No element matching method supported");return i.call(t,e)}function r(t){t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)}function n(t,e){return Array.prototype.filter.call(t.children,function(t){return s(t,e)})}var m={main:"ps",element:{thumb:function(t){return"ps__thumb-"+t},rail:function(t){return"ps__rail-"+t},consuming:"ps__child--consume"},state:{focus:"ps--focus",clicking:"ps--clicking",active:function(t){return"ps--active-"+t},scrolling:function(t){return"ps--scrolling-"+t}}},o={x:null,y:null};function Y(t,e){var i=t.element.classList,l=m.state.scrolling(e);i.contains(l)?clearTimeout(o[e]):i.add(l)}function X(t,e){o[e]=setTimeout(function(){return t.isAlive&&t.element.classList.remove(m.state.scrolling(e))},t.settings.scrollingThreshold)}var l=function(t){this.element=t,this.handlers={}},t={isEmpty:{configurable:!0}};l.prototype.bind=function(t,e){void 0===this.handlers[t]&&(this.handlers[t]=[]),this.handlers[t].push(e),this.element.addEventListener(t,e,!1)},l.prototype.unbind=function(e,i){var l=this;this.handlers[e]=this.handlers[e].filter(function(t){return!(!i||t===i)||(l.element.removeEventListener(e,t,!1),!1)})},l.prototype.unbindAll=function(){for(var t in this.handlers)this.unbind(t)},t.isEmpty.get=function(){var e=this;return Object.keys(this.handlers).every(function(t){return 0===e.handlers[t].length})},Object.defineProperties(l.prototype,t);var p=function(){this.eventElements=[]};function b(t){if("function"==typeof window.CustomEvent)return new CustomEvent(t);var e=document.createEvent("CustomEvent");return e.initCustomEvent(t,!1,!1,void 0),e}p.prototype.eventElement=function(e){var t=this.eventElements.filter(function(t){return t.element===e})[0];return t||(t=new l(e),this.eventElements.push(t)),t},p.prototype.bind=function(t,e,i){this.eventElement(t).bind(e,i)},p.prototype.unbind=function(t,e,i){var l=this.eventElement(t);l.unbind(e,i),l.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(l),1)},p.prototype.unbindAll=function(){this.eventElements.forEach(function(t){return t.unbindAll()}),this.eventElements=[]},p.prototype.once=function(t,e,i){var l=this.eventElement(t),r=function(t){l.unbind(e,r),i(t)};l.bind(e,r)};var e=function(t,e,i,l,r){var n;if(void 0===l&&(l=!0),void 0===r&&(r=!1),"top"===e)n=["contentHeight","containerHeight","scrollTop","y","up","down"];else{if("left"!==e)throw new Error("A proper axis should be provided");n=["contentWidth","containerWidth","scrollLeft","x","left","right"]}!function(t,e,i,l,r){var n=i[0],o=i[1],s=i[2],a=i[3],c=i[4],h=i[5];void 0===l&&(l=!0);void 0===r&&(r=!1);var u=t.element;t.reach[a]=null,u[s]<1&&(t.reach[a]="start");u[s]>t[n]-t[o]-1&&(t.reach[a]="end");e&&(u.dispatchEvent(b("ps-scroll-"+a)),e<0?u.dispatchEvent(b("ps-scroll-"+c)):0=t.railXWidth-t.scrollbarXWidth&&(t.scrollbarXLeft=t.railXWidth-t.scrollbarXWidth),t.scrollbarYTop>=t.railYHeight-t.scrollbarYHeight&&(t.scrollbarYTop=t.railYHeight-t.scrollbarYHeight),function(t,e){var i={width:e.railXWidth},l=Math.floor(t.scrollTop);e.isRtl?i.left=e.negativeScrollAdjustment+t.scrollLeft+e.containerWidth-e.contentWidth:i.left=t.scrollLeft;e.isScrollbarXUsingBottom?i.bottom=e.scrollbarXBottom-l:i.top=e.scrollbarXTop+l;d(e.scrollbarXRail,i);var r={top:l,height:e.railYHeight};e.isScrollbarYUsingRight?e.isRtl?r.right=e.contentWidth-(e.negativeScrollAdjustment+t.scrollLeft)-e.scrollbarYRight-e.scrollbarYOuterWidth:r.right=e.scrollbarYRight-t.scrollLeft:e.isRtl?r.left=e.negativeScrollAdjustment+t.scrollLeft+2*e.containerWidth-e.contentWidth-e.scrollbarYLeft-e.scrollbarYOuterWidth:r.left=e.scrollbarYLeft+t.scrollLeft;d(e.scrollbarYRail,r),d(e.scrollbarX,{left:e.scrollbarXLeft,width:e.scrollbarXWidth-e.railBorderXWidth}),d(e.scrollbarY,{top:e.scrollbarYTop,height:e.scrollbarYHeight-e.railBorderYWidth})}(e,t),t.scrollbarXActive?e.classList.add(m.state.active("x")):(e.classList.remove(m.state.active("x")),t.scrollbarXWidth=0,t.scrollbarXLeft=0,e.scrollLeft=0),t.scrollbarYActive?e.classList.add(m.state.active("y")):(e.classList.remove(m.state.active("y")),t.scrollbarYHeight=0,t.scrollbarYTop=0,e.scrollTop=0)};function a(t,e){return t.settings.minScrollbarLength&&(e=Math.max(e,t.settings.minScrollbarLength)),t.settings.maxScrollbarLength&&(e=Math.min(e,t.settings.maxScrollbarLength)),e}function c(e,t){var i=t[0],l=t[1],r=t[2],n=t[3],o=t[4],s=t[5],a=t[6],c=t[7],h=t[8],u=e.element,d=null,f=null,p=null;function b(t){u[a]=d+p*(t[r]-f),Y(e,c),y(e),t.stopPropagation(),t.preventDefault()}function g(){X(e,c),e[h].classList.remove(m.state.clicking),e.event.unbind(e.ownerDocument,"mousemove",b)}e.event.bind(e[o],"mousedown",function(t){d=u[a],f=t[r],p=(e[l]-e[i])/(e[n]-e[s]),e.event.bind(e.ownerDocument,"mousemove",b),e.event.once(e.ownerDocument,"mouseup",g),e[h].classList.add(m.state.clicking),t.stopPropagation(),t.preventDefault()})}var W={"click-rail":function(i){i.event.bind(i.scrollbarY,"mousedown",function(t){return t.stopPropagation()}),i.event.bind(i.scrollbarYRail,"mousedown",function(t){var e=t.pageY-window.pageYOffset-i.scrollbarYRail.getBoundingClientRect().top>i.scrollbarYTop?1:-1;i.element.scrollTop+=e*i.containerHeight,y(i),t.stopPropagation()}),i.event.bind(i.scrollbarX,"mousedown",function(t){return t.stopPropagation()}),i.event.bind(i.scrollbarXRail,"mousedown",function(t){var e=t.pageX-window.pageXOffset-i.scrollbarXRail.getBoundingClientRect().left>i.scrollbarXLeft?1:-1;i.element.scrollLeft+=e*i.containerWidth,y(i),t.stopPropagation()})},"drag-thumb":function(t){c(t,["containerWidth","contentWidth","pageX","railXWidth","scrollbarX","scrollbarXWidth","scrollLeft","x","scrollbarXRail"]),c(t,["containerHeight","contentHeight","pageY","railYHeight","scrollbarY","scrollbarYHeight","scrollTop","y","scrollbarYRail"])},keyboard:function(n){var o=n.element;n.event.bind(n.ownerDocument,"keydown",function(t){if(!(t.isDefaultPrevented&&t.isDefaultPrevented()||t.defaultPrevented)&&(s(o,":hover")||s(n.scrollbarX,":focus")||s(n.scrollbarY,":focus"))){var e,i=document.activeElement?document.activeElement:n.ownerDocument.activeElement;if(i){if("IFRAME"===i.tagName)i=i.contentDocument.activeElement;else for(;i.shadowRoot;)i=i.shadowRoot.activeElement;if(s(e=i,"input,[contenteditable]")||s(e,"select,[contenteditable]")||s(e,"textarea,[contenteditable]")||s(e,"button,[contenteditable]"))return}var l=0,r=0;switch(t.which){case 37:l=t.metaKey?-n.contentWidth:t.altKey?-n.containerWidth:-30;break;case 38:r=t.metaKey?n.contentHeight:t.altKey?n.containerHeight:30;break;case 39:l=t.metaKey?n.contentWidth:t.altKey?n.containerWidth:30;break;case 40:r=t.metaKey?-n.contentHeight:t.altKey?-n.containerHeight:-30;break;case 32:r=t.shiftKey?n.containerHeight:-n.containerHeight;break;case 33:r=n.containerHeight;break;case 34:r=-n.containerHeight;break;case 36:r=n.contentHeight;break;case 35:r=-n.contentHeight;break;default:return}n.settings.suppressScrollX&&0!==l||n.settings.suppressScrollY&&0!==r||(o.scrollTop-=r,o.scrollLeft+=l,y(n),function(t,e){var i=Math.floor(o.scrollTop);if(0===t){if(!n.scrollbarYActive)return!1;if(0===i&&0=n.contentHeight-n.containerHeight&&e<0)return!n.settings.wheelPropagation}var l=o.scrollLeft;if(0===e){if(!n.scrollbarXActive)return!1;if(0===l&&t<0||l>=n.contentWidth-n.containerWidth&&0Math.abs(s)?h||u:d||f)||!b.settings.wheelPropagation))&&!t.ctrlKey&&(t.stopPropagation(),t.preventDefault())}}void 0!==window.onwheel?b.event.bind(g,"wheel",t):void 0!==window.onmousewheel&&b.event.bind(g,"mousewheel",t)},touch:function(s){if(w.supportsTouch||w.supportsIePointer){var a=s.element,c={},h=0,u={},i=null;w.supportsTouch?(s.event.bind(a,"touchstart",t),s.event.bind(a,"touchmove",e),s.event.bind(a,"touchend",l)):w.supportsIePointer&&(window.PointerEvent?(s.event.bind(a,"pointerdown",t),s.event.bind(a,"pointermove",e),s.event.bind(a,"pointerup",l)):window.MSPointerEvent&&(s.event.bind(a,"MSPointerDown",t),s.event.bind(a,"MSPointerMove",e),s.event.bind(a,"MSPointerUp",l)))}function d(t,e){a.scrollTop-=e,a.scrollLeft-=t,y(s)}function f(t){return t.targetTouches?t.targetTouches[0]:t}function p(t){return!(t.pointerType&&"pen"===t.pointerType&&0===t.buttons||(!t.targetTouches||1!==t.targetTouches.length)&&(!t.pointerType||"mouse"===t.pointerType||t.pointerType===t.MSPOINTER_TYPE_MOUSE))}function t(t){if(p(t)){var e=f(t);c.pageX=e.pageX,c.pageY=e.pageY,h=(new Date).getTime(),null!==i&&clearInterval(i)}}function e(t){if(p(t)){var e=f(t),i={pageX:e.pageX,pageY:e.pageY},l=i.pageX-c.pageX,r=i.pageY-c.pageY;if(function(t,e,i){if(!a.contains(t))return!1;for(var l=t;l&&l!==a;){if(l.classList.contains(m.element.consuming))return!0;var r=v(l);if([r.overflow,r.overflowX,r.overflowY].join("").match(/(scroll|auto)/)){var n=l.scrollHeight-l.clientHeight;if(0=this.contentWidth-this.containerWidth?"end":null,y:t.scrollTop<=0?"start":t.scrollTop>=this.contentHeight-this.containerHeight?"end":null},this.isAlive=!0,this.settings.handlers.forEach(function(t){return W[t](i)}),this.lastScrollTop=Math.floor(t.scrollTop),this.lastScrollLeft=t.scrollLeft,this.event.bind(this.element,"scroll",function(t){return i.onScroll(t)}),y(this)};return h.prototype.update=function(){this.isAlive&&(this.negativeScrollAdjustment=this.isNegativeScroll?this.element.scrollWidth-this.element.clientWidth:0,d(this.scrollbarXRail,{display:"block"}),d(this.scrollbarYRail,{display:"block"}),this.railXMarginWidth=g(v(this.scrollbarXRail).marginLeft)+g(v(this.scrollbarXRail).marginRight),this.railYMarginHeight=g(v(this.scrollbarYRail).marginTop)+g(v(this.scrollbarYRail).marginBottom),d(this.scrollbarXRail,{display:"none"}),d(this.scrollbarYRail,{display:"none"}),y(this),e(this,"top",0,!1,!0),e(this,"left",0,!1,!0),d(this.scrollbarXRail,{display:""}),d(this.scrollbarYRail,{display:""}))},h.prototype.onScroll=function(t){this.isAlive&&(y(this),e(this,"top",this.element.scrollTop-this.lastScrollTop),e(this,"left",this.element.scrollLeft-this.lastScrollLeft),this.lastScrollTop=Math.floor(this.element.scrollTop),this.lastScrollLeft=this.element.scrollLeft)},h.prototype.destroy=function(){this.isAlive&&(this.event.unbindAll(),r(this.scrollbarX),r(this.scrollbarY),r(this.scrollbarXRail),r(this.scrollbarYRail),this.removePsClasses(),this.element=null,this.scrollbarX=null,this.scrollbarY=null,this.scrollbarXRail=null,this.scrollbarYRail=null,this.isAlive=!1)},h.prototype.removePsClasses=function(){this.element.className=this.element.className.split(" ").filter(function(t){return!t.match(/^ps([-_].+|)$/)}).join(" ")},h}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.PerfectScrollbar=e()}(this,function(){"use strict";function g(t){return getComputedStyle(t)}function h(t,e){for(var i in e){var r=e[i];"number"==typeof r&&(r+="px"),t.style[i]=r}return t}function u(t){var e=document.createElement("div");return e.className=t,e}var i="undefined"!=typeof Element&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector);function o(t,e){if(!i)throw new Error("No element matching method supported");return i.call(t,e)}function n(t){t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)}function s(t,e){return Array.prototype.filter.call(t.children,function(t){return o(t,e)})}var m={main:"ps",rtl:"ps__rtl",element:{thumb:function(t){return"ps__thumb-"+t},rail:function(t){return"ps__rail-"+t},consuming:"ps__child--consume"},state:{focus:"ps--focus",clicking:"ps--clicking",active:function(t){return"ps--active-"+t},scrolling:function(t){return"ps--scrolling-"+t}}},l={x:null,y:null};function Y(t,e){var i=t.element.classList,r=m.state.scrolling(e);i.contains(r)?clearTimeout(l[e]):i.add(r)}function X(t,e){l[e]=setTimeout(function(){return t.isAlive&&t.element.classList.remove(m.state.scrolling(e))},t.settings.scrollingThreshold)}function r(t){this.element=t,this.handlers={}}var t={isEmpty:{configurable:!0}};r.prototype.bind=function(t,e){void 0===this.handlers[t]&&(this.handlers[t]=[]),this.handlers[t].push(e),this.element.addEventListener(t,e,!1)},r.prototype.unbind=function(e,i){var r=this;this.handlers[e]=this.handlers[e].filter(function(t){return!(!i||t===i)||(r.element.removeEventListener(e,t,!1),!1)})},r.prototype.unbindAll=function(){for(var t in this.handlers)this.unbind(t)},t.isEmpty.get=function(){var e=this;return Object.keys(this.handlers).every(function(t){return 0===e.handlers[t].length})},Object.defineProperties(r.prototype,t);function d(){this.eventElements=[]}function f(t){if("function"==typeof window.CustomEvent)return new CustomEvent(t);var e=document.createEvent("CustomEvent");return e.initCustomEvent(t,!1,!1,void 0),e}d.prototype.eventElement=function(e){var t=this.eventElements.filter(function(t){return t.element===e})[0];return t||(t=new r(e),this.eventElements.push(t)),t},d.prototype.bind=function(t,e,i){this.eventElement(t).bind(e,i)},d.prototype.unbind=function(t,e,i){var r=this.eventElement(t);r.unbind(e,i),r.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(r),1)},d.prototype.unbindAll=function(){this.eventElements.forEach(function(t){return t.unbindAll()}),this.eventElements=[]},d.prototype.once=function(t,e,i){var r=this.eventElement(t),l=function(t){r.unbind(e,l),i(t)};r.bind(e,l)};function e(t,e,i,r,l){var n;if(void 0===r&&(r=!0),void 0===l&&(l=!1),"top"===e)n=["contentHeight","containerHeight","scrollTop","y","up","down"];else{if("left"!==e)throw new Error("A proper axis should be provided");n=["contentWidth","containerWidth","scrollLeft","x","left","right"]}!function(t,e,i,r,l){var n=i[0],o=i[1],s=i[2],a=i[3],c=i[4],h=i[5];void 0===r&&(r=!0);void 0===l&&(l=!1);var u=t.element;t.reach[a]=null,u[s]<1&&(t.reach[a]="start");u[s]>t[n]-t[o]-1&&(t.reach[a]="end");e&&(u.dispatchEvent(f("ps-scroll-"+a)),e<0?u.dispatchEvent(f("ps-scroll-"+c)):0=t.railXWidth-t.scrollbarXWidth&&(t.scrollbarXLeft=t.railXWidth-t.scrollbarXWidth),t.scrollbarYTop>=t.railYHeight-t.scrollbarYHeight&&(t.scrollbarYTop=t.railYHeight-t.scrollbarYHeight),function(t,e){var i={width:e.railXWidth},r=Math.floor(t.scrollTop);e.isRtl?i.left=e.negativeScrollAdjustment+t.scrollLeft+e.containerWidth-e.contentWidth:i.left=t.scrollLeft;e.isScrollbarXUsingBottom?i.bottom=e.scrollbarXBottom-r:i.top=e.scrollbarXTop+r;h(e.scrollbarXRail,i);var l={top:r+e.settings.getTopOffset(),height:e.railYHeight};e.isScrollbarYUsingRight?e.isRtl?l.right=e.contentWidth-(e.negativeScrollAdjustment+t.scrollLeft)-e.scrollbarYRight-e.scrollbarYOuterWidth-9:l.right=e.scrollbarYRight-t.scrollLeft:e.isRtl?l.left=e.negativeScrollAdjustment+t.scrollLeft+2*e.containerWidth-e.contentWidth-e.scrollbarYLeft-e.scrollbarYOuterWidth:l.left=e.scrollbarYLeft+t.scrollLeft;h(e.scrollbarYRail,l),h(e.scrollbarX,{left:e.scrollbarXLeft,width:e.scrollbarXWidth-e.railBorderXWidth}),h(e.scrollbarY,{top:e.scrollbarYTop,height:e.scrollbarYHeight-e.railBorderYWidth})}(e,t),t.scrollbarXActive?e.classList.add(m.state.active("x")):(e.classList.remove(m.state.active("x")),t.scrollbarXWidth=0,t.scrollbarXLeft=0,e.scrollLeft=!0===t.isRtl?t.contentWidth:0),t.scrollbarYActive?e.classList.add(m.state.active("y")):(e.classList.remove(m.state.active("y")),t.scrollbarYHeight=0,t.scrollbarYTop=0,e.scrollTop=0)}var b={isWebKit:"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style,supportsTouch:"undefined"!=typeof window&&("ontouchstart"in window||"maxTouchPoints"in window.navigator&&0=this.contentWidth-this.containerWidth?"end":null,y:t.scrollTop<=0?"start":t.scrollTop>=this.contentHeight-this.containerHeight?"end":null},this.isAlive=!0,this.settings.handlers.forEach(function(t){return y[t](l)}),this.lastScrollTop=Math.floor(t.scrollTop),this.lastScrollLeft=t.scrollLeft,this.event.bind(this.element,"scroll",function(t){return l.onScroll(t)}),w(this)}var y={"click-rail":function(i){i.event.bind(i.scrollbarY,"mousedown",function(t){return t.stopPropagation()}),i.event.bind(i.scrollbarYRail,"mousedown",function(t){var e=t.pageY-window.pageYOffset-i.scrollbarYRail.getBoundingClientRect().top>i.scrollbarYTop?1:-1;i.element.scrollTop+=e*i.containerHeight,w(i),t.stopPropagation()}),i.event.bind(i.scrollbarX,"mousedown",function(t){return t.stopPropagation()}),i.event.bind(i.scrollbarXRail,"mousedown",function(t){var e=t.pageX-window.pageXOffset-i.scrollbarXRail.getBoundingClientRect().left>i.scrollbarXLeft?1:-1;i.element.scrollLeft+=e*i.containerWidth,w(i),t.stopPropagation()})},"drag-thumb":function(t){c(t,["containerWidth","contentWidth","pageX","railXWidth","scrollbarX","scrollbarXWidth","scrollLeft","x","scrollbarXRail"]),c(t,["containerHeight","contentHeight","pageY","railYHeight","scrollbarY","scrollbarYHeight","scrollTop","y","scrollbarYRail"])},keyboard:function(l){var n=l.element;l.event.bind(l.ownerDocument,"keydown",function(t){if(!(t.isDefaultPrevented&&t.isDefaultPrevented()||t.defaultPrevented)&&(o(n,":hover")||o(l.scrollbarX,":focus")||o(l.scrollbarY,":focus"))){var e=document.activeElement?document.activeElement:l.ownerDocument.activeElement;if(e){if("IFRAME"===e.tagName)e=e.contentDocument.activeElement;else for(;e.shadowRoot;)e=e.shadowRoot.activeElement;if(function(t){return o(t,"input,[contenteditable]")||o(t,"select,[contenteditable]")||o(t,"textarea,[contenteditable]")||o(t,"button,[contenteditable]")}(e))return}var i=0,r=0;switch(t.which){case 37:i=t.metaKey?-l.contentWidth:t.altKey?-l.containerWidth:-30;break;case 38:r=t.metaKey?l.contentHeight:t.altKey?l.containerHeight:30;break;case 39:i=t.metaKey?l.contentWidth:t.altKey?l.containerWidth:30;break;case 40:r=t.metaKey?-l.contentHeight:t.altKey?-l.containerHeight:-30;break;case 32:r=t.shiftKey?l.containerHeight:-l.containerHeight;break;case 33:r=l.containerHeight;break;case 34:r=-l.containerHeight;break;case 36:r=l.contentHeight;break;case 35:r=-l.contentHeight;break;default:return}l.settings.suppressScrollX&&0!==i||l.settings.suppressScrollY&&0!==r||(n.scrollTop-=r,n.scrollLeft+=i,w(l),function(t,e){var i=Math.floor(n.scrollTop);if(0===t){if(!l.scrollbarYActive)return!1;if(0===i&&0=l.contentHeight-l.containerHeight&&e<0)return!l.settings.wheelPropagation}var r=n.scrollLeft;if(0===e){if(!l.scrollbarXActive)return!1;if(0===r&&t<0||r>=l.contentWidth-l.containerWidth&&0Math.abs(t)?r||l:n||o)||!s.settings.wheelPropagation}(i,r))&&!t.ctrlKey&&(t.stopPropagation(),t.preventDefault())}}void 0!==window.onwheel?s.event.bind(a,"wheel",t):void 0!==window.onmousewheel&&s.event.bind(a,"mousewheel",t)},touch:function(s){if(b.supportsTouch||b.supportsIePointer){var a=s.element,c={},h=0,u={},i=null;b.supportsTouch?(s.event.bind(a,"touchstart",t),s.event.bind(a,"touchmove",e),s.event.bind(a,"touchend",r)):b.supportsIePointer&&(window.PointerEvent?(s.event.bind(a,"pointerdown",t),s.event.bind(a,"pointermove",e),s.event.bind(a,"pointerup",r)):window.MSPointerEvent&&(s.event.bind(a,"MSPointerDown",t),s.event.bind(a,"MSPointerMove",e),s.event.bind(a,"MSPointerUp",r)))}function d(t,e){a.scrollTop-=e,a.scrollLeft-=t,w(s)}function f(t){return t.targetTouches?t.targetTouches[0]:t}function p(t){return(!t.pointerType||"pen"!==t.pointerType||0!==t.buttons)&&(!(!t.targetTouches||1!==t.targetTouches.length)||!(!t.pointerType||"mouse"===t.pointerType||t.pointerType===t.MSPOINTER_TYPE_MOUSE))}function t(t){if(p(t)){var e=f(t);c.pageX=e.pageX,c.pageY=e.pageY,h=(new Date).getTime(),null!==i&&clearInterval(i)}}function e(t){if(p(t)){var e=f(t),i={pageX:e.pageX,pageY:e.pageY},r=i.pageX-c.pageX,l=i.pageY-c.pageY;if(function(t,e,i){if(!a.contains(t))return!1;for(var r=t;r&&r!==a;){if(r.classList.contains(m.element.consuming))return!0;var l=g(r);if(i&&l.overflowY.match(/(scroll|auto)/)){var n=r.scrollHeight-r.clientHeight;if(0 ({ useBothWheelAxes: false, wheelPropagation: true, wheelSpeed: 1, + getTopOffset: () => 0, + getBottomOffset: () => 0, }); const handlers = { diff --git a/src/update-geometry.js b/src/update-geometry.js index 3a160def2..bd71e88a0 100644 --- a/src/update-geometry.js +++ b/src/update-geometry.js @@ -8,10 +8,11 @@ export default function(i) { const roundedScrollTop = Math.floor(element.scrollTop); const rect = element.getBoundingClientRect(); + const fixedHeaderFooterHeight = i.settings.getTopOffset() + i.settings.getBottomOffset(); i.containerWidth = Math.ceil(rect.width); - i.containerHeight = Math.ceil(rect.height); + i.containerHeight = Math.ceil(rect.height) - fixedHeaderFooterHeight; i.contentWidth = element.scrollWidth; - i.contentHeight = element.scrollHeight; + i.contentHeight = element.scrollHeight - fixedHeaderFooterHeight; if (!element.contains(i.scrollbarXRail)) { // clean up and append @@ -125,7 +126,7 @@ function updateCss(element, i) { } CSS.set(i.scrollbarXRail, xRailOffset); - const yRailOffset = { top: roundedScrollTop, height: i.railYHeight }; + const yRailOffset = { top: roundedScrollTop + i.settings.getTopOffset(), height: i.railYHeight }; if (i.isScrollbarYUsingRight) { if (i.isRtl) { yRailOffset.right =