Skip to content

Commit

Permalink
menu not hiding CreativeIT#51
Browse files Browse the repository at this point in the history
- merge commit
  • Loading branch information
franckevva committed Mar 29, 2017
1 parent 1181ba9 commit 3ec47c2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion getmdl-select.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion getmdl-select.min.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion getmdl-select.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion getmdl-select.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions src/js/getmdl-select.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
'use strict';

window.addEventListener('load', function () {
window.onload = function () {
getmdlSelect.init('.getmdl-select');
document.addEventListener("DOMNodeInserted", function (ev) {
if (ev.relatedNode.querySelectorAll(".getmdl-select").length > 0) {
componentHandler.upgradeDom();
}
}, false);
});
};

var getmdlSelect = {
defaultValue : {
Expand Down Expand Up @@ -47,18 +46,20 @@
if ("createEvent" in document) {
var evt = document.createEvent("HTMLEvents");
evt.initEvent("change", false, true);
menu['MaterialMenu'].hide()
menu['MaterialMenu'].hide();
input.dispatchEvent(evt);
} else {
input.fireEvent("onchange");
}
};
});
},
init: function (selector) {
init: function (selector, widthDef) {
var dropdowns = document.querySelectorAll(selector);
[].forEach.call(dropdowns, function (i) {
getmdlSelect.addEventListeners(i);
var width = widthDef ? widthDef : (i.querySelector('.mdl-menu').offsetWidth ? i.querySelector('.mdl-menu').offsetWidth : getmdlSelect.defaultValue.width);
i.style.width = width + 'px';
});
}
};
Expand Down
6 changes: 4 additions & 2 deletions src/scss/getmdl-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
}
}
}
.getmdl-select__fullwidth, .mdl-menu {
width: 100%;
.getmdl-select__fullwidth {
.mdl-menu {
width: 100%;
}
}

.getmdl-select__fix-height{
Expand Down

0 comments on commit 3ec47c2

Please sign in to comment.