Skip to content

Commit

Permalink
Simplify the mobile.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
frjo committed Aug 7, 2022
1 parent 39b7768 commit f4bdc66
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions assets/js/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@

'use strict';

// Activate the mobil menu for small screens.
if (window.matchMedia && $('.mobile-nav').length) {
var mq = window.matchMedia('(max-width: 999px)');
if (mq.matches) {
// Toggle the mobile nav sheet.
$('.mobile-nav__cover, .mobile-nav__toggle').handle('click', function () {
$('body').scroll().toggleClass('js-nav-open');
});
// 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).
$('.mobile-nav__sheet').find('a').on('click', function () {
$('body').removeClass('js-nav-open');
});
}
}
// Close the nav sheet after click (needed for anchor links).
$('.mobile-nav__sheet').find('a').on('click', function () {
$('body').removeClass('js-nav-open');
});

})(u);

0 comments on commit f4bdc66

Please # to comment.