nimbus-site/themes/navy/source/js/mobile_nav.js

27 lines
802 B
JavaScript
Raw Normal View History

2018-10-03 22:02:24 +00:00
$(document).ready(function () {
2018-09-28 18:47:04 +00:00
2018-10-03 22:02:24 +00:00
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
2018-09-28 18:47:04 +00:00
2018-10-03 22:02:24 +00:00
$(window).on('resize', function(event) {
w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
setMenu(w);
2018-09-28 18:47:04 +00:00
});
2018-10-03 22:02:24 +00:00
function setMenu(w){
if (w < 1199) {
$('.header header').appendTo('.mobile-menu-container .ecosystem');
$('.header .secondary-nav').appendTo('.mobile-menu-container .community');
}else{
$('.mobile-menu-container header').appendTo('.header .header-left');
$('.mobile-menu-container .secondary-nav').insertAfter('.header .header-left');
};
}
2018-09-28 18:47:04 +00:00
2018-10-03 22:02:24 +00:00
setMenu(w);
$('.mobile-menu-trigger, .backdrop, .mobile-menu-container .close').on('click', function () {
$('body').toggleClass('open');
2018-09-28 18:47:04 +00:00
});
2018-10-03 22:02:24 +00:00
});