Restoring menu items custom width when they get moved back into desktop from offcanvas (fixes #228, fixes #223)

This commit is contained in:
Djamil Legato
2015-05-15 12:01:44 -07:00
parent 03a594c261
commit 118febc55a
2 changed files with 22 additions and 2 deletions
+11 -1
View File
@@ -259,7 +259,7 @@ var Menu = new prime({
var selectors = this.options.selectors,
mobileContainer = $(selectors.mobileContainer),
mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer),
find;
find, dropdowns;
if (mq.matches) {
find = mainContainer.find(selectors.topLevel);
@@ -270,6 +270,16 @@ var Menu = new prime({
}
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'));
});
}
},
_debug: function() {}
+11 -1
View File
@@ -280,7 +280,7 @@ var Menu = new prime({
var selectors = this.options.selectors,
mobileContainer = $(selectors.mobileContainer),
mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer),
find;
find, dropdowns;
if (mq.matches) {
find = mainContainer.find(selectors.topLevel);
@@ -291,6 +291,16 @@ var Menu = new prime({
}
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'));
});
}
},
_debug: function() {}