Skip to content

Commit a2b10f6

Browse files
author
Oleg Zinoviev
committed
Merge branch 'MAGETWO-34929' of github.corp.ebay.com:magento-webdev/magento2ce into MAGETWO-34929
2 parents 62c3414 + 8346304 commit a2b10f6

File tree

2 files changed

+30
-22
lines changed
  • app/design/adminhtml/Magento/backend

2 files changed

+30
-22
lines changed

app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_menu.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
}
6767
&._fixed {
6868
left: 0;
69-
top: 0;
7069
position: fixed;
70+
top: 0;
7171
~ .page-wrapper {
7272
margin-left: @menu__width;
7373
}
@@ -205,8 +205,8 @@
205205
padding: @submenu__padding-vertical 0 0;
206206
position: absolute;
207207
top: -@menu-logo__outer-size;
208-
transition-property: left, visibility;
209208
transition-duration: .5s;
209+
transition-property: left, visibility;
210210
transition-timing-function: ease;
211211
visibility: hidden;
212212
z-index: @submenu__z-index;

app/design/adminhtml/Magento/backend/web/js/theme.js

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,59 +14,70 @@ define('globalNavigationScroll', [
1414
winHeight,
1515
menuHeight = menu.height(),
1616
menuHeightRest = 0,
17+
menuScrollMax = 0,
1718
contentHeight,
1819
winTop = 0,
1920
winTopLast = 0,
2021
scrollStep = 0,
2122
nextTop = 0,
2223
fixedClass = '_fixed';
2324

25+
/**
26+
* Check if menu is fixed
27+
* @returns {boolean}
28+
*/
2429
function isMenuFixed() {
2530
return (menuHeight < contentHeight) && (contentHeight > winHeight);
2631
}
2732

33+
/**
34+
* Add fixed menu class
35+
* @param {jQuery} el
36+
*/
2837
function addFixed(el) {
2938
if (!el.hasClass(fixedClass)) {
3039
el.addClass(fixedClass);
3140
}
3241
}
3342

43+
/**
44+
* Remove fixed menu class
45+
* @param {jQuery} el
46+
*/
3447
function removeFixed(el) {
3548
if (el.hasClass(fixedClass)) {
3649
el.removeClass(fixedClass);
3750
}
3851
}
3952

53+
/**
54+
* Calculate and apply menu position
55+
*/
4056
function positionMenu() {
4157

42-
// Spot positions and heights
58+
// Spotting positions and heights
4359
winHeight = win.height();
4460
contentHeight = content.height();
4561
winTop = win.scrollTop();
46-
scrollStep = winTop - winTopLast; // scroll step
47-
menuHeightRest = menuHeight - winTop; // visible menu height
62+
scrollStep = winTop - winTopLast;
63+
menuHeightRest = menuHeight - winTop; // is a visible menu height
4864

49-
// Fixed menu cases
50-
if (isMenuFixed()) {
65+
if (isMenuFixed()) { // fixed menu cases
5166

5267
addFixed(menu);
5368

54-
// Smart scroll cases
55-
if (menuHeight > winHeight) {
69+
if (menuHeight > winHeight) { // smart scroll cases
5670

57-
// Scroll down
58-
if (winTop > winTopLast) {
71+
if (winTop > winTopLast) { // scroll down
5972

60-
var menuScrollMax = menuHeight - winHeight;
73+
menuScrollMax = menuHeight - winHeight;
6174

6275
nextTop < (menuScrollMax - scrollStep) ?
6376
nextTop += scrollStep : nextTop = menuScrollMax;
6477

6578
menu.css('top', -nextTop);
6679

67-
}
68-
// Scroll up
69-
else if (winTop < winTopLast) {
80+
} else if (winTop < winTopLast) { // scroll up
7081

7182
nextTop > -scrollStep ?
7283
nextTop += scrollStep : nextTop = 0;
@@ -76,8 +87,8 @@ define('globalNavigationScroll', [
7687
}
7788

7889
}
79-
// Static menu cases
80-
} else {
90+
91+
} else { // static menu cases
8192
removeFixed(menu);
8293
}
8394

@@ -86,8 +97,7 @@ define('globalNavigationScroll', [
8697

8798
}
8899

89-
// Page start calculation
90-
positionMenu();
100+
positionMenu(); // page start calculation
91101

92102
// Change position on scroll
93103
win.on('scroll', function () {
@@ -99,9 +109,7 @@ define('globalNavigationScroll', [
99109
winHeight = win.height();
100110

101111
// Reset position if fixed and out of smart scroll
102-
if (
103-
(menuHeight < contentHeight) && (menuHeight <= winHeight)
104-
) {
112+
if ((menuHeight < contentHeight) && (menuHeight <= winHeight)) {
105113
menu.removeAttr('style');
106114
}
107115

0 commit comments

Comments
 (0)