Skip to content

Commit 6fe831c

Browse files
author
Natalia Momotenko
committed
Merge remote-tracking branch 'origin/MAGETWO-54318' into bugfixes
2 parents 86f3996 + 34e7861 commit 6fe831c

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lib/web/mage/menu.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ define([
1818
options: {
1919
responsive: false,
2020
expanded: false,
21-
delay: 300
21+
showDelay: 42,
22+
hideDelay: 300,
23+
mediaBreakpoint: '(max-width: 768px)'
2224
},
2325
_create: function () {
2426
var self = this;
@@ -31,15 +33,14 @@ define([
3133

3234
_init: function () {
3335
this._super();
34-
this.delay = this.options.delay;
3536

3637
if (this.options.expanded === true) {
3738
this.isExpanded();
3839
}
3940

4041
if (this.options.responsive === true) {
4142
mediaCheck({
42-
media: '(max-width: 640px)',
43+
media: this.options.mediaBreakpoint,
4344
entry: $.proxy(function () {
4445
this._toggleMobileMode();
4546
}, this),
@@ -70,16 +71,18 @@ define([
7071
},
7172

7273
toggle: function () {
73-
if ($('html').hasClass('nav-open')) {
74-
$('html').removeClass('nav-open');
74+
var html = $('html');
75+
76+
if (html.hasClass('nav-open')) {
77+
html.removeClass('nav-open');
7578
setTimeout(function () {
76-
$('html').removeClass('nav-before-open');
77-
}, 300);
79+
html.removeClass('nav-before-open');
80+
}, this.options.hideDelay);
7881
} else {
79-
$('html').addClass('nav-before-open');
82+
html.addClass('nav-before-open');
8083
setTimeout(function () {
81-
$('html').addClass('nav-open');
82-
}, 42);
84+
html.addClass('nav-open');
85+
}, this.options.showDelay);
8386
}
8487
},
8588

0 commit comments

Comments
 (0)