* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @module WoltLabSuite/Core/Ui/Page/Action
*/
-define(['Dictionary', 'Language'], function (Dictionary, Language) {
+define(['Dictionary', 'Language', 'Ui/Screen'], function (Dictionary, Language, UiScreen) {
'use strict';
var _buttons = new Dictionary();
var _resetLastPosition = window.debounce(function () {
_lastPosition = -1;
}, 50, false);
+
+ var _toTopButtonThreshold = 300;
/**
* @exports WoltLabSuite/Core/Ui/Page/Action
_lastPosition = -1;
}
}, {passive: true});
+
+ UiScreen.on('screen-sm-down', {
+ match() {
+ _toTopButtonThreshold = 50;
+ },
+ unmatch() {
+ _toTopButtonThreshold = 300;
+ },
+ setup() {
+ _toTopButtonThreshold = 50;
+ }
+ });
this._onScroll();
},
return;
}
- if (offset >= 300) {
+ if (offset >= _toTopButtonThreshold) {
if (_toTopButton.classList.contains('initiallyHidden')) {
_toTopButton.classList.remove('initiallyHidden');
}
}
_container.classList[(hasVisibleItems ? 'add' : 'remove')]('active');
+
+ if (hasVisibleItems) {
+ _wrapper.classList.add("pageActionHasContextButtons");
+ }
+ else {
+ _wrapper.classList.remove("pageActionHasContextButtons");
+ }
}
};
});
}
@include screen-sm-down {
- /* The iOS bottom touch zone is approximately 44px high. Any touches within will show the
+ /* The iOS bottom touch zone is approximately 30px high. Any touches within will show the
menu instead of registering any touch on a button. */
- bottom: 44px;
+ bottom: 30px;
+ transition: bottom .12s linear;
- &.scrolledDown .pageActionButton,
- &.scrolledDown .pageActionButtonToTop {
- opacity: 0;
- visibility: hidden;
- transition-delay: .4s;
+ &:not(.pageActionHasContextButtons) {
+ &.scrolledDown .pageActionButton,
+ &.scrolledDown .pageActionButtonToTop {
+ opacity: 0;
+ visibility: hidden;
+ transition-delay: .4s;
+ }
}
}
}
@include screen-xs {
.redactorActive .pageAction {
- display: none !important;
+ bottom: 10px;
+
+ &:not(.pageActionHasContextButtons) {
+ display: none !important;
+ }
}
}