@@ -18,7 +18,9 @@ define([
18
18
options : {
19
19
responsive : false ,
20
20
expanded : false ,
21
- delay : 300
21
+ showDelay : 42 ,
22
+ hideDelay : 300 ,
23
+ mediaBreakpoint : '(max-width: 768px)'
22
24
} ,
23
25
_create : function ( ) {
24
26
var self = this ;
@@ -31,15 +33,14 @@ define([
31
33
32
34
_init : function ( ) {
33
35
this . _super ( ) ;
34
- this . delay = this . options . delay ;
35
36
36
37
if ( this . options . expanded === true ) {
37
38
this . isExpanded ( ) ;
38
39
}
39
40
40
41
if ( this . options . responsive === true ) {
41
42
mediaCheck ( {
42
- media : '(max-width: 640px)' ,
43
+ media : this . options . mediaBreakpoint ,
43
44
entry : $ . proxy ( function ( ) {
44
45
this . _toggleMobileMode ( ) ;
45
46
} , this ) ,
@@ -70,16 +71,18 @@ define([
70
71
} ,
71
72
72
73
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' ) ;
75
78
setTimeout ( function ( ) {
76
- $ ( ' html' ) . removeClass ( 'nav-before-open' ) ;
77
- } , 300 ) ;
79
+ html . removeClass ( 'nav-before-open' ) ;
80
+ } , this . options . hideDelay ) ;
78
81
} else {
79
- $ ( ' html' ) . addClass ( 'nav-before-open' ) ;
82
+ html . addClass ( 'nav-before-open' ) ;
80
83
setTimeout ( function ( ) {
81
- $ ( ' html' ) . addClass ( 'nav-open' ) ;
82
- } , 42 ) ;
84
+ html . addClass ( 'nav-open' ) ;
85
+ } , this . options . showDelay ) ;
83
86
}
84
87
} ,
85
88
0 commit comments