Added mobilmenu param option.
This commit is contained in:
parent
f111aec76a
commit
59bc1494af
3 changed files with 9 additions and 8 deletions
|
|
@ -33,11 +33,7 @@
|
|||
</footer>
|
||||
|
||||
</div>
|
||||
<div class="mobile-nav-wrapper hidden">
|
||||
<div class="mobile-nav-cover"></div>
|
||||
<a href="#navigation" class="mobile-nav-toggle" aria-haspopup="true" role="button">{{ i18n "menu_mobile" }}</a>
|
||||
<div class="mobile-nav-sheet"></div>
|
||||
</div>
|
||||
{{ if $.Param "mobilemenu" }}{{ partial "mobilemenu.html" . }}{{ end -}}
|
||||
{{ partial "scripts.html" . -}}
|
||||
{{ partialCached "scripts_cache.html" . -}}
|
||||
</body>
|
||||
|
|
|
|||
5
layouts/partials/mobilemenu.html
Normal file
5
layouts/partials/mobilemenu.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div class="mobile-nav-wrapper hidden">
|
||||
<div class="mobile-nav-cover"></div>
|
||||
<a href="#navigation" class="mobile-nav-toggle" aria-haspopup="true" role="button">{{ i18n "menu_mobile" }}</a>
|
||||
<div class="mobile-nav-sheet"></div>
|
||||
</div>
|
||||
|
|
@ -11,15 +11,15 @@
|
|||
$('html').removeClass('nojs').addClass('js');
|
||||
|
||||
// Activate the mobil menu for small screens.
|
||||
if (window.matchMedia) {
|
||||
if (window.matchMedia && $('.mobile-nav-wrapper').length) {
|
||||
var mq = window.matchMedia('(max-width: 666px)');
|
||||
if (mq.matches) {
|
||||
// Show mobile menu.
|
||||
$('.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').filter(':not(:empty)').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').addClass('js-main-menu').appendTo('.mobile-nav-sheet').find('.navbar').removeClass('navbar').addClass('js-navbar');
|
||||
|
||||
// Toggle the mobile nav sheet.
|
||||
$('.mobile-nav-cover, .mobile-nav-toggle').on('click toushstart', function (e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue