Simplify the mobile.js.
This commit is contained in:
parent
39b7768b4f
commit
f4bdc66a40
1 changed files with 8 additions and 14 deletions
|
|
@ -7,21 +7,15 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Activate the mobil menu for small screens.
|
// Toggle the mobile nav sheet.
|
||||||
if (window.matchMedia && $('.mobile-nav').length) {
|
$('.mobile-nav__cover, .mobile-nav__toggle').handle('click', function () {
|
||||||
var mq = window.matchMedia('(max-width: 999px)');
|
$('body').scroll().toggleClass('js-nav-open');
|
||||||
if (mq.matches) {
|
});
|
||||||
// Toggle the mobile nav sheet.
|
|
||||||
$('.mobile-nav__cover, .mobile-nav__toggle').handle('click', function () {
|
|
||||||
$('body').scroll().toggleClass('js-nav-open');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Close the nav sheet after click (needed for anchor links).
|
// Close the nav sheet after click (needed for anchor links).
|
||||||
$('.mobile-nav__sheet').find('a').on('click', function () {
|
$('.mobile-nav__sheet').find('a').on('click', function () {
|
||||||
$('body').removeClass('js-nav-open');
|
$('body').removeClass('js-nav-open');
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})(u);
|
})(u);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue