Mobil menu improvments.
This commit is contained in:
parent
2fddcb499f
commit
3c897e0650
1 changed files with 44 additions and 13 deletions
|
|
@ -8,7 +8,7 @@
|
|||
'use strict';
|
||||
|
||||
// Add a js class to the html-tag when JavsScript is active.
|
||||
$('html').addClass('js');
|
||||
$('html').removeClass('nojs').addClass('js');
|
||||
|
||||
// Activate the mobil menu for small screens.
|
||||
if (window.matchMedia) {
|
||||
|
|
@ -18,16 +18,21 @@
|
|||
$('.mobile-nav-wrapper').removeClass('hidden');
|
||||
|
||||
// Populate the mobile nav sheet.
|
||||
$('.header__region').removeClass('header__region region hidden').addClass('js-region').appendTo('.mobile-nav-sheet');
|
||||
$('.main-menu').addClass('hidden').clone().removeClass('main-menu layout__navigation layout__full hidden hidden').addClass('js-main-menu').appendTo('.mobile-nav-sheet').find('.navbar').removeClass('navbar').addClass('js-navbar');
|
||||
$('.header__region').addClass('hidden').clone().removeClass('header__region region hidden').addClass('js-region').appendTo('.mobile-nav-sheet');
|
||||
|
||||
// Toggle the mobile nav sheet.
|
||||
$('.mobile-nav-cover, .mobile-nav-toggle').on('click toushstart', function (e) {
|
||||
e.preventDefault();
|
||||
$('.mobile-nav-wrapper').toggleClass('js-nav-open');
|
||||
$('body').scrollTop(0).toggleClass('js-nav-open');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Display CSS grid layout warning to old browsers.
|
||||
if (!window.CSS || !window.CSS.supports || !window.CSS.supports('display', 'grid')) {
|
||||
$('.header').after('<div class="layout__grid-notice" role="complementary">Your browsers does not support modern grid layout so this page will not look or behave as it should. Resent versions of Chrome, Firefox and Safari all works so please update. Support is coming in Microsoft Edge as well, until then use another browser. <a href="https://www.whatbrowser.org/">What Browser?</a></div>');
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
|
|
|
|||
Loading…
Reference in a new issue