mirror of
https://github.com/gantry/gantry5.git
synced 2026-08-19 01:15:04 -05:00
Collapse navigation when menu is moved in mobile container (fixes #181)
This commit is contained in:
@@ -262,22 +262,30 @@ var Menu = new prime({
|
||||
find, dropdowns;
|
||||
|
||||
if (mq.matches) {
|
||||
// move to Mobile Container
|
||||
find = mainContainer.find(selectors.topLevel);
|
||||
if (find) { find.top(mobileContainer); }
|
||||
if (find) {
|
||||
mainContainer.parent('.g-block').addClass('hidden');
|
||||
mobileContainer.parent('.g-block').removeClass('hidden');
|
||||
find.top(mobileContainer);
|
||||
}
|
||||
} else {
|
||||
// move back to Original Location
|
||||
find = mobileContainer.find(selectors.topLevel);
|
||||
if (find) { find.top(mainContainer); }
|
||||
if (find) {
|
||||
mobileContainer.parent('.g-block').addClass('hidden');
|
||||
mainContainer.parent('.g-block').removeClass('hidden');
|
||||
find.top(mainContainer);
|
||||
}
|
||||
}
|
||||
|
||||
this.resetStates(find);
|
||||
|
||||
// we need to reintroduce fixed widths for those dropdowns that come with it
|
||||
if (!mq.matches && (find && (dropdowns = find.search('[data-g-item-width]')))) {
|
||||
console.log(dropdowns);
|
||||
dropdowns.forEach(function(dropdown) {
|
||||
dropdown = $(dropdown);
|
||||
dropdown[0].style.width = dropdown.data('g-item-width');
|
||||
console.log(dropdown, dropdown.data('g-item-width'));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -350,7 +350,7 @@ var Offcanvas = new prime({
|
||||
|
||||
togglers[shouldCollapse ? 'addClass' : 'removeClass']('g-offcanvas-hide');
|
||||
if (mobileContainer) {
|
||||
mobileContainer.parent('.g-content')[!mCtext ? 'addClass' : 'removeClass']('nomarginall')[!mCtext ? 'addClass' : 'removeClass']('nopaddingall');
|
||||
mobileContainer.parent('.g-block')[!mCtext ? 'addClass' : 'removeClass']('hidden');
|
||||
}
|
||||
|
||||
if (!shouldCollapse && !this.attached) { this.attach(); }
|
||||
|
||||
Reference in New Issue
Block a user