diff --git a/src/javascript/vanilla-js-dropdown.js b/src/javascript/vanilla-js-dropdown.js index 4412959..733cd05 100644 --- a/src/javascript/vanilla-js-dropdown.js +++ b/src/javascript/vanilla-js-dropdown.js @@ -20,6 +20,7 @@ var CustomSelect = function(options) { optgroupClass = 'js-Dropdown-optgroup', selectedClass = 'is-selected', openClass = 'is-open', + openClassBtn = 'is-open-btn', selectOpgroups = elem.getElementsByTagName('optgroup'), selectOptions = elem.options, optionsLength = selectOptions.length, @@ -108,7 +109,7 @@ var CustomSelect = function(options) { var t = e.target; // || e.srcElement; - uncomment for IE8 - if (t.className === titleClass) { + if (t.className.includes(titleClass)) { toggle(); } @@ -137,6 +138,7 @@ var CustomSelect = function(options) { */ function toggle() { ul.classList.toggle(openClass); + button.classList.toggle(openClassBtn); } /** @@ -146,6 +148,7 @@ var CustomSelect = function(options) { */ function open() { ul.classList.add(openClass); + button.classList.add(openClassBtn); } /** @@ -155,6 +158,7 @@ var CustomSelect = function(options) { */ function close() { ul.classList.remove(openClass); + button.classList.remove(openClassBtn); } return {