mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-25 11:00:36 +03:00
version 1.4.0
This commit is contained in:
@@ -212,7 +212,7 @@ Take the table below only as a overview of all options.
|
||||
<td>autoHide</td>
|
||||
<td>string</td>
|
||||
<td><code>"never"</code></td>
|
||||
<td>The possibility to hide visible scrollbars after a certain action.</td>
|
||||
<td>The possibility to hide visible scrollbars automatically after a certain action.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
* OverlayScrollbars
|
||||
* https://github.com/KingSora/OverlayScrollbars
|
||||
*
|
||||
* Version: 1.3.0
|
||||
* Version: 1.4.0
|
||||
*
|
||||
* Copyright KingSora.
|
||||
* https://github.com/KingSora
|
||||
*
|
||||
* Released under the MIT license.
|
||||
* Date: 26.02.2018
|
||||
* Date: 02.03.2018
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+71
-37
@@ -2,13 +2,13 @@
|
||||
* OverlayScrollbars
|
||||
* https://github.com/KingSora/OverlayScrollbars
|
||||
*
|
||||
* Version: 1.3.0
|
||||
* Version: 1.4.0
|
||||
*
|
||||
* Copyright KingSora.
|
||||
* https://github.com/KingSora
|
||||
*
|
||||
* Released under the MIT license.
|
||||
* Date: 26.02.2018
|
||||
* Date: 02.03.2018
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
@@ -1406,7 +1406,7 @@
|
||||
},
|
||||
scrollbars : {
|
||||
visibility : 'auto', //visible || hidden || auto || v || h || a
|
||||
autoHide : 'never', //never || scroll || leave || n || s || l
|
||||
autoHide : 'never', //never || scroll || leave || move || n || s || l || m
|
||||
autoHideDelay : 800, //number
|
||||
dragScrolling : true, //true || false
|
||||
clickScrolling : false, //true || false
|
||||
@@ -1846,6 +1846,8 @@
|
||||
var _strMouseTouchDownEvent = 'mousedown touchstart';
|
||||
var _strMouseTouchUpEvent = 'mouseup touchend';
|
||||
var _strMouseTouchMoveEvent = 'mousemove touchmove';
|
||||
var _strMouseTouchEnter = 'mouseenter';
|
||||
var _strMouseTouchLeave = 'mouseleave';
|
||||
var _strKeyDownEvent = 'keydown';
|
||||
var _strKeyUpEvent = 'keyup';
|
||||
var _strSelectStartEvent = 'selectstart';
|
||||
@@ -1997,12 +1999,14 @@
|
||||
|
||||
//scrollbars:
|
||||
var _scrollbarsAutoHideTimeoutId;
|
||||
var _scrollbarsAutoHideMoveTimeoutId;
|
||||
var _scrollbarsAutoHideDelay;
|
||||
var _scrollbarsAutoHideNever;
|
||||
var _scrollbarsAutoHideScroll;
|
||||
var _scrollbarsAutoHideMove;
|
||||
var _scrollbarsAutoHideLeave;
|
||||
var _scrollbarsTouchSupport;
|
||||
var _scrollbarsAutoHideScrollAndHovered;
|
||||
var _scrollbarsAutoHideFlagScrollAndHovered;
|
||||
|
||||
//resize
|
||||
var _resizeReconnectMutationObserver;
|
||||
@@ -2754,11 +2758,11 @@
|
||||
else {
|
||||
var strActive = 'active';
|
||||
var hide = function () {
|
||||
if (!_scrollbarsAutoHideScrollAndHovered) {
|
||||
if (!_scrollbarsAutoHideFlagScrollAndHovered) {
|
||||
var anyActive = _scrollbarHorizontalHandleElement.hasClass(strActive) || _scrollbarVerticalHandleElement.hasClass(strActive);
|
||||
if (!anyActive && (_scrollbarsAutoHideScroll || _scrollbarsAutoHideLeave))
|
||||
if (!anyActive && (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove || _scrollbarsAutoHideLeave))
|
||||
_scrollbarHorizontalElement.addClass(_classNameScrollbarAutoHidden);
|
||||
if (!anyActive && (_scrollbarsAutoHideScroll || _scrollbarsAutoHideLeave))
|
||||
if (!anyActive && (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove || _scrollbarsAutoHideLeave))
|
||||
_scrollbarVerticalElement.addClass(_classNameScrollbarAutoHidden);
|
||||
}
|
||||
};
|
||||
@@ -2979,7 +2983,7 @@
|
||||
event.clientY >= rect.top && event.clientY <= rect.bottom)) {
|
||||
hostOnMouseLeave();
|
||||
}
|
||||
if (_scrollbarsAutoHideScroll)
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove)
|
||||
refreshScrollbarsAutoHide(false);
|
||||
};
|
||||
var documentKeyDown = function (event) {
|
||||
@@ -3101,13 +3105,13 @@
|
||||
compatibility.prvD(event);
|
||||
}
|
||||
}).hover(function () { //make sure both scrollbars will stay visible if one scrollbar is hovered if autoHide is "scroll".
|
||||
if (_scrollbarsAutoHideScroll) {
|
||||
_scrollbarsAutoHideScrollAndHovered = true;
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove) {
|
||||
_scrollbarsAutoHideFlagScrollAndHovered = true;
|
||||
refreshScrollbarsAutoHide(true);
|
||||
}
|
||||
}, function () {
|
||||
if (_scrollbarsAutoHideScroll) {
|
||||
_scrollbarsAutoHideScrollAndHovered = false;
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove) {
|
||||
_scrollbarsAutoHideFlagScrollAndHovered = false;
|
||||
refreshScrollbarsAutoHide(false);
|
||||
}
|
||||
});
|
||||
@@ -3154,6 +3158,20 @@
|
||||
refreshScrollbarsAutoHide(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The mouse leave event of the host element. This event is only needed for the autoHide feature.
|
||||
*/
|
||||
function hostOnMouseMove() {
|
||||
if (_scrollbarsAutoHideMove) {
|
||||
refreshScrollbarsAutoHide(true);
|
||||
clearTimeout(_scrollbarsAutoHideMoveTimeoutId);
|
||||
_scrollbarsAutoHideMoveTimeoutId = setTimeout(function () {
|
||||
if (_scrollbarsAutoHideMove)
|
||||
refreshScrollbarsAutoHide(false);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The scroll event of the viewport element. That is the main scroll event. It controls also the "scroll", "scrollStart" and "scrollStop" callbacks.
|
||||
* @param event The scroll event.
|
||||
@@ -3169,7 +3187,7 @@
|
||||
if (_scrollStopTimeoutId !== undefined)
|
||||
clearTimeout(_scrollStopTimeoutId);
|
||||
else {
|
||||
if (_scrollbarsAutoHideScroll)
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove)
|
||||
refreshScrollbarsAutoHide(true);
|
||||
|
||||
if (!nativeOverlayScrollbarsAreActive())
|
||||
@@ -3199,7 +3217,7 @@
|
||||
function onScrollStop() {
|
||||
clearTimeout(_scrollStopTimeoutId);
|
||||
_scrollStopTimeoutId = undefined;
|
||||
if (_scrollbarsAutoHideScroll)
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove)
|
||||
refreshScrollbarsAutoHide(false);
|
||||
|
||||
if (!nativeOverlayScrollbarsAreActive())
|
||||
@@ -3534,7 +3552,7 @@
|
||||
var classNameAllowedValues = ['*', null];
|
||||
var overflowBehaviorAllowedValues = ['v-h:visible-hidden', 'v-s:visible-scroll', 's:scroll', 'h:hidden'];
|
||||
var scrollbarsVisibilityAllowedValues = ['v:visible', 'h:hidden', 'a:auto'];
|
||||
var scrollbarsAutoHideAllowedValues = ['n:never', 's:scroll', 'l:leave'];
|
||||
var scrollbarsAutoHideAllowedValues = ['n:never', 's:scroll', 'l:leave', 'm:move'];
|
||||
var resizeAllowedValues = ['n:none', 'b:both', 'h:horizontal', 'v:vertical'];
|
||||
var strCallbacksDot = 'callbacks.';
|
||||
var strScrollbarsDot = _strScrollbar + 's.';
|
||||
@@ -3899,6 +3917,7 @@
|
||||
//scrollbars visibility
|
||||
_scrollbarsAutoHideNever = scrollbarsAutoHide === 'n';
|
||||
_scrollbarsAutoHideScroll = scrollbarsAutoHide === 's';
|
||||
_scrollbarsAutoHideMove = scrollbarsAutoHide === 'm';
|
||||
_scrollbarsAutoHideLeave = scrollbarsAutoHide === 'l';
|
||||
|
||||
//scrollbars autoHideDelay
|
||||
@@ -4236,7 +4255,12 @@
|
||||
var strOverflowY = strOverflow + '-y';
|
||||
var strHidden = 'hidden';
|
||||
var strVisible = 'visible';
|
||||
var hideOverflow4CorrectMeasuring = _restrictedMeasuring ? (_nativeScrollbarIsOverlaid.x || _nativeScrollbarIsOverlaid.y) || (_viewportSize.w < _nativeScrollbarMinSize.y || _viewportSize.h < _nativeScrollbarMinSize.x) : false;;
|
||||
//decide whether the content overflow must get hidden for correct overflow measuring, it MUST be always hidden if the height is auto
|
||||
var hideOverflow4CorrectMeasuring = _restrictedMeasuring ?
|
||||
(_nativeScrollbarIsOverlaid.x || _nativeScrollbarIsOverlaid.y) || //it must be hidden if native scrollbars are overlaid
|
||||
(_viewportSize.w < _nativeScrollbarMinSize.y || _viewportSize.h < _nativeScrollbarMinSize.x) || //it must be hidden if host-element is too small
|
||||
heightAuto //it must be hidden if height is auto
|
||||
: heightAuto; //if there is not the restricted Measuring bug, it must be hidden if the height is auto
|
||||
|
||||
//Reset the viewport (very important for natively overlaid scrollbars and zoom change
|
||||
var viewportElementResetCSS = {};
|
||||
@@ -4251,7 +4275,7 @@
|
||||
//measure several sizes:
|
||||
var contentMeasureElement = getContentMeasureElement();
|
||||
//in Firefox content element has to have overflow hidden, else element margins aren't calculated properly, this element prevents this bug, but only if scrollbars aren't overlaid
|
||||
var contentMeasureElementGuaranty = hideOverflow4CorrectMeasuring ? contentMeasureElement : _viewportElement[0];
|
||||
var contentMeasureElementGuaranty = _restrictedMeasuring && !hideOverflow4CorrectMeasuring ? _viewportElement[0] : contentMeasureElement;
|
||||
var clientSize = {
|
||||
w: contentMeasureElement[WORDING.cW],
|
||||
h: contentMeasureElement[WORDING.cH]
|
||||
@@ -4696,34 +4720,42 @@
|
||||
|
||||
//manage the scrollbars auto hide feature (auto hide them after specific actions)
|
||||
if (scrollbarsAutoHideChanged || ignoreOverlayScrollbarHidingChanged) {
|
||||
var strMouseEnter = 'mouseenter';
|
||||
var strMouseLeave = 'mouseleave';
|
||||
var addLeaveEvents = function () {
|
||||
var addMouseTouchEvents = function (move) {
|
||||
if (_supportPassiveEvents) {
|
||||
addPassiveEventListener(_hostElement, strMouseEnter, hostOnMouseEnter);
|
||||
addPassiveEventListener(_hostElement, strMouseLeave, hostOnMouseLeave);
|
||||
if(move)
|
||||
addPassiveEventListener(_hostElement, _strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
else {
|
||||
addPassiveEventListener(_hostElement, _strMouseTouchEnter, hostOnMouseEnter);
|
||||
addPassiveEventListener(_hostElement, _strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_hostElement.on(strMouseEnter, hostOnMouseEnter);
|
||||
_hostElement.on(strMouseLeave, hostOnMouseLeave);
|
||||
if(move)
|
||||
_hostElement.on(_strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
else {
|
||||
_hostElement.on(_strMouseTouchEnter, hostOnMouseEnter);
|
||||
_hostElement.on(_strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLeaveEvents = function () {
|
||||
var removeMouseTouchEvents = function () {
|
||||
if (_supportPassiveEvents) {
|
||||
removePassiveEventListener(_hostElement, strMouseEnter, hostOnMouseEnter);
|
||||
removePassiveEventListener(_hostElement, strMouseLeave, hostOnMouseLeave);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchEnter, hostOnMouseEnter);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
else {
|
||||
_hostElement.off(strMouseEnter, hostOnMouseEnter);
|
||||
_hostElement.off(strMouseLeave, hostOnMouseLeave);
|
||||
_hostElement.off(_strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
_hostElement.off(_strMouseTouchEnter, hostOnMouseEnter);
|
||||
_hostElement.off(_strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
};
|
||||
if (_scrollbarsAutoHideLeave) {
|
||||
removeLeaveEvents();
|
||||
addLeaveEvents();
|
||||
if (_scrollbarsAutoHideLeave || _scrollbarsAutoHideMove) {
|
||||
removeMouseTouchEvents();
|
||||
addMouseTouchEvents(_scrollbarsAutoHideMove);
|
||||
}
|
||||
else {
|
||||
removeLeaveEvents();
|
||||
removeMouseTouchEvents();
|
||||
}
|
||||
|
||||
if (_scrollbarsAutoHideNever)
|
||||
@@ -4939,12 +4971,14 @@
|
||||
_sizeAutoObserverElement.remove();
|
||||
|
||||
if (_supportPassiveEvents) {
|
||||
removePassiveEventListener(_hostElement, 'mouseenter', hostOnMouseEnter);
|
||||
removePassiveEventListener(_hostElement, 'mouseleave', hostOnMouseLeave);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchEnter, hostOnMouseEnter);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
else {
|
||||
_hostElement.off('mouseenter', hostOnMouseEnter);
|
||||
_hostElement.off('mouseleave', hostOnMouseLeave);
|
||||
_hostElement.off(_strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
_hostElement.off(_strMouseTouchEnter, hostOnMouseEnter);
|
||||
_hostElement.off(_strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
|
||||
_scrollbarHorizontalElement.remove();
|
||||
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
@@ -2,13 +2,13 @@
|
||||
* OverlayScrollbars
|
||||
* https://github.com/KingSora/OverlayScrollbars
|
||||
*
|
||||
* Version: 1.3.0
|
||||
* Version: 1.4.0
|
||||
*
|
||||
* Copyright KingSora.
|
||||
* https://github.com/KingSora
|
||||
*
|
||||
* Released under the MIT license.
|
||||
* Date: 26.02.2018
|
||||
* Date: 02.03.2018
|
||||
*/
|
||||
|
||||
(function (global, factory) {
|
||||
@@ -435,7 +435,7 @@
|
||||
},
|
||||
scrollbars : {
|
||||
visibility : 'auto', //visible || hidden || auto || v || h || a
|
||||
autoHide : 'never', //never || scroll || leave || n || s || l
|
||||
autoHide : 'never', //never || scroll || leave || move || n || s || l || m
|
||||
autoHideDelay : 800, //number
|
||||
dragScrolling : true, //true || false
|
||||
clickScrolling : false, //true || false
|
||||
@@ -875,6 +875,8 @@
|
||||
var _strMouseTouchDownEvent = 'mousedown touchstart';
|
||||
var _strMouseTouchUpEvent = 'mouseup touchend';
|
||||
var _strMouseTouchMoveEvent = 'mousemove touchmove';
|
||||
var _strMouseTouchEnter = 'mouseenter';
|
||||
var _strMouseTouchLeave = 'mouseleave';
|
||||
var _strKeyDownEvent = 'keydown';
|
||||
var _strKeyUpEvent = 'keyup';
|
||||
var _strSelectStartEvent = 'selectstart';
|
||||
@@ -1026,12 +1028,14 @@
|
||||
|
||||
//scrollbars:
|
||||
var _scrollbarsAutoHideTimeoutId;
|
||||
var _scrollbarsAutoHideMoveTimeoutId;
|
||||
var _scrollbarsAutoHideDelay;
|
||||
var _scrollbarsAutoHideNever;
|
||||
var _scrollbarsAutoHideScroll;
|
||||
var _scrollbarsAutoHideMove;
|
||||
var _scrollbarsAutoHideLeave;
|
||||
var _scrollbarsTouchSupport;
|
||||
var _scrollbarsAutoHideScrollAndHovered;
|
||||
var _scrollbarsAutoHideFlagScrollAndHovered;
|
||||
|
||||
//resize
|
||||
var _resizeReconnectMutationObserver;
|
||||
@@ -1783,11 +1787,11 @@
|
||||
else {
|
||||
var strActive = 'active';
|
||||
var hide = function () {
|
||||
if (!_scrollbarsAutoHideScrollAndHovered) {
|
||||
if (!_scrollbarsAutoHideFlagScrollAndHovered) {
|
||||
var anyActive = _scrollbarHorizontalHandleElement.hasClass(strActive) || _scrollbarVerticalHandleElement.hasClass(strActive);
|
||||
if (!anyActive && (_scrollbarsAutoHideScroll || _scrollbarsAutoHideLeave))
|
||||
if (!anyActive && (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove || _scrollbarsAutoHideLeave))
|
||||
_scrollbarHorizontalElement.addClass(_classNameScrollbarAutoHidden);
|
||||
if (!anyActive && (_scrollbarsAutoHideScroll || _scrollbarsAutoHideLeave))
|
||||
if (!anyActive && (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove || _scrollbarsAutoHideLeave))
|
||||
_scrollbarVerticalElement.addClass(_classNameScrollbarAutoHidden);
|
||||
}
|
||||
};
|
||||
@@ -1808,7 +1812,6 @@
|
||||
|
||||
//get and apply intended handle length
|
||||
var handleRatio = Math.min(1, (_hostSizeCache[scrollbarVars._wh] - (_paddingAbsoluteCache ? (isHorizontal ? _paddingX : _paddingY) : 0)) / _contentScrollSizeCache[scrollbarVars._wh]);
|
||||
handleRatio = isNaN(handleRatio) ? 0 : handleRatio;
|
||||
handleCSS[scrollbarVars.wh] = (Math.floor(handleRatio * 100 * 100000) / 100000) + "%"; //the last * 100000 / 100000 is for flooring to the 4th digit
|
||||
|
||||
if (!nativeOverlayScrollbarsAreActive())
|
||||
@@ -2009,7 +2012,7 @@
|
||||
event.clientY >= rect.top && event.clientY <= rect.bottom)) {
|
||||
hostOnMouseLeave();
|
||||
}
|
||||
if (_scrollbarsAutoHideScroll)
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove)
|
||||
refreshScrollbarsAutoHide(false);
|
||||
};
|
||||
var documentKeyDown = function (event) {
|
||||
@@ -2131,13 +2134,13 @@
|
||||
compatibility.prvD(event);
|
||||
}
|
||||
}).hover(function () { //make sure both scrollbars will stay visible if one scrollbar is hovered if autoHide is "scroll".
|
||||
if (_scrollbarsAutoHideScroll) {
|
||||
_scrollbarsAutoHideScrollAndHovered = true;
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove) {
|
||||
_scrollbarsAutoHideFlagScrollAndHovered = true;
|
||||
refreshScrollbarsAutoHide(true);
|
||||
}
|
||||
}, function () {
|
||||
if (_scrollbarsAutoHideScroll) {
|
||||
_scrollbarsAutoHideScrollAndHovered = false;
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove) {
|
||||
_scrollbarsAutoHideFlagScrollAndHovered = false;
|
||||
refreshScrollbarsAutoHide(false);
|
||||
}
|
||||
});
|
||||
@@ -2184,6 +2187,20 @@
|
||||
refreshScrollbarsAutoHide(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The mouse leave event of the host element. This event is only needed for the autoHide feature.
|
||||
*/
|
||||
function hostOnMouseMove() {
|
||||
if (_scrollbarsAutoHideMove) {
|
||||
refreshScrollbarsAutoHide(true);
|
||||
clearTimeout(_scrollbarsAutoHideMoveTimeoutId);
|
||||
_scrollbarsAutoHideMoveTimeoutId = setTimeout(function () {
|
||||
if (_scrollbarsAutoHideMove)
|
||||
refreshScrollbarsAutoHide(false);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The scroll event of the viewport element. That is the main scroll event. It controls also the "scroll", "scrollStart" and "scrollStop" callbacks.
|
||||
* @param event The scroll event.
|
||||
@@ -2199,7 +2216,7 @@
|
||||
if (_scrollStopTimeoutId !== undefined)
|
||||
clearTimeout(_scrollStopTimeoutId);
|
||||
else {
|
||||
if (_scrollbarsAutoHideScroll)
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove)
|
||||
refreshScrollbarsAutoHide(true);
|
||||
|
||||
if (!nativeOverlayScrollbarsAreActive())
|
||||
@@ -2229,7 +2246,7 @@
|
||||
function onScrollStop() {
|
||||
clearTimeout(_scrollStopTimeoutId);
|
||||
_scrollStopTimeoutId = undefined;
|
||||
if (_scrollbarsAutoHideScroll)
|
||||
if (_scrollbarsAutoHideScroll || _scrollbarsAutoHideMove)
|
||||
refreshScrollbarsAutoHide(false);
|
||||
|
||||
if (!nativeOverlayScrollbarsAreActive())
|
||||
@@ -2564,7 +2581,7 @@
|
||||
var classNameAllowedValues = ['*', null];
|
||||
var overflowBehaviorAllowedValues = ['v-h:visible-hidden', 'v-s:visible-scroll', 's:scroll', 'h:hidden'];
|
||||
var scrollbarsVisibilityAllowedValues = ['v:visible', 'h:hidden', 'a:auto'];
|
||||
var scrollbarsAutoHideAllowedValues = ['n:never', 's:scroll', 'l:leave'];
|
||||
var scrollbarsAutoHideAllowedValues = ['n:never', 's:scroll', 'l:leave', 'm:move'];
|
||||
var resizeAllowedValues = ['n:none', 'b:both', 'h:horizontal', 'v:vertical'];
|
||||
var strCallbacksDot = 'callbacks.';
|
||||
var strScrollbarsDot = _strScrollbar + 's.';
|
||||
@@ -2929,6 +2946,7 @@
|
||||
//scrollbars visibility
|
||||
_scrollbarsAutoHideNever = scrollbarsAutoHide === 'n';
|
||||
_scrollbarsAutoHideScroll = scrollbarsAutoHide === 's';
|
||||
_scrollbarsAutoHideMove = scrollbarsAutoHide === 'm';
|
||||
_scrollbarsAutoHideLeave = scrollbarsAutoHide === 'l';
|
||||
|
||||
//scrollbars autoHideDelay
|
||||
@@ -3266,7 +3284,12 @@
|
||||
var strOverflowY = strOverflow + '-y';
|
||||
var strHidden = 'hidden';
|
||||
var strVisible = 'visible';
|
||||
var hideOverflow4CorrectMeasuring = _restrictedMeasuring ? (_nativeScrollbarIsOverlaid.x || _nativeScrollbarIsOverlaid.y) || (_viewportSize.w < _nativeScrollbarMinSize.y || _viewportSize.h < _nativeScrollbarMinSize.x) : false;
|
||||
//decide whether the content overflow must get hidden for correct overflow measuring, it MUST be always hidden if the height is auto
|
||||
var hideOverflow4CorrectMeasuring = _restrictedMeasuring ?
|
||||
(_nativeScrollbarIsOverlaid.x || _nativeScrollbarIsOverlaid.y) || //it must be hidden if native scrollbars are overlaid
|
||||
(_viewportSize.w < _nativeScrollbarMinSize.y || _viewportSize.h < _nativeScrollbarMinSize.x) || //it must be hidden if host-element is too small
|
||||
heightAuto //it must be hidden if height is auto
|
||||
: heightAuto; //if there is not the restricted Measuring bug, it must be hidden if the height is auto
|
||||
|
||||
//Reset the viewport (very important for natively overlaid scrollbars and zoom change
|
||||
var viewportElementResetCSS = {};
|
||||
@@ -3726,34 +3749,42 @@
|
||||
|
||||
//manage the scrollbars auto hide feature (auto hide them after specific actions)
|
||||
if (scrollbarsAutoHideChanged || ignoreOverlayScrollbarHidingChanged) {
|
||||
var strMouseEnter = 'mouseenter';
|
||||
var strMouseLeave = 'mouseleave';
|
||||
var addLeaveEvents = function () {
|
||||
var addMouseTouchEvents = function (move) {
|
||||
if (_supportPassiveEvents) {
|
||||
addPassiveEventListener(_hostElement, strMouseEnter, hostOnMouseEnter);
|
||||
addPassiveEventListener(_hostElement, strMouseLeave, hostOnMouseLeave);
|
||||
if(move)
|
||||
addPassiveEventListener(_hostElement, _strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
else {
|
||||
addPassiveEventListener(_hostElement, _strMouseTouchEnter, hostOnMouseEnter);
|
||||
addPassiveEventListener(_hostElement, _strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_hostElement.on(strMouseEnter, hostOnMouseEnter);
|
||||
_hostElement.on(strMouseLeave, hostOnMouseLeave);
|
||||
if(move)
|
||||
_hostElement.on(_strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
else {
|
||||
_hostElement.on(_strMouseTouchEnter, hostOnMouseEnter);
|
||||
_hostElement.on(_strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
}
|
||||
};
|
||||
var removeLeaveEvents = function () {
|
||||
var removeMouseTouchEvents = function () {
|
||||
if (_supportPassiveEvents) {
|
||||
removePassiveEventListener(_hostElement, strMouseEnter, hostOnMouseEnter);
|
||||
removePassiveEventListener(_hostElement, strMouseLeave, hostOnMouseLeave);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchEnter, hostOnMouseEnter);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
else {
|
||||
_hostElement.off(strMouseEnter, hostOnMouseEnter);
|
||||
_hostElement.off(strMouseLeave, hostOnMouseLeave);
|
||||
_hostElement.off(_strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
_hostElement.off(_strMouseTouchEnter, hostOnMouseEnter);
|
||||
_hostElement.off(_strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
};
|
||||
if (_scrollbarsAutoHideLeave) {
|
||||
removeLeaveEvents();
|
||||
addLeaveEvents();
|
||||
if (_scrollbarsAutoHideLeave || _scrollbarsAutoHideMove) {
|
||||
removeMouseTouchEvents();
|
||||
addMouseTouchEvents(_scrollbarsAutoHideMove);
|
||||
}
|
||||
else {
|
||||
removeLeaveEvents();
|
||||
removeMouseTouchEvents();
|
||||
}
|
||||
|
||||
if (_scrollbarsAutoHideNever)
|
||||
@@ -3969,12 +4000,14 @@
|
||||
_sizeAutoObserverElement.remove();
|
||||
|
||||
if (_supportPassiveEvents) {
|
||||
removePassiveEventListener(_hostElement, 'mouseenter', hostOnMouseEnter);
|
||||
removePassiveEventListener(_hostElement, 'mouseleave', hostOnMouseLeave);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchEnter, hostOnMouseEnter);
|
||||
removePassiveEventListener(_hostElement, _strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
else {
|
||||
_hostElement.off('mouseenter', hostOnMouseEnter);
|
||||
_hostElement.off('mouseleave', hostOnMouseLeave);
|
||||
_hostElement.off(_strMouseTouchMoveEvent, hostOnMouseMove);
|
||||
_hostElement.off(_strMouseTouchEnter, hostOnMouseEnter);
|
||||
_hostElement.off(_strMouseTouchLeave, hostOnMouseLeave);
|
||||
}
|
||||
|
||||
_scrollbarHorizontalElement.remove();
|
||||
@@ -4838,5 +4871,6 @@
|
||||
_pluginGlobals.defaultOptions = helper.extend(true, { }, currDefaultOptions , newDefaultOptions);
|
||||
};
|
||||
})(COMPATIBILITY, INSTANCES, HELPER, BYPROPERTYPATH);
|
||||
|
||||
return window[PLUGINNAME];
|
||||
})));
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "overlayscrollbars",
|
||||
"version": "1.3.0",
|
||||
"version": "1.4.0",
|
||||
"description": "A javascript scrollbar plugin which hides the native scrollbars and provides custom styleable overlay scrollbars, but keeps the native functionality and feeling.",
|
||||
"keywords" : [
|
||||
"overlayscrollbars",
|
||||
|
||||
Reference in New Issue
Block a user