diff --git a/lib/src/index.js b/lib/src/index.js index 83fdfff..aa29e93 100644 --- a/lib/src/index.js +++ b/lib/src/index.js @@ -56,9 +56,10 @@ const MicroModal = (() => { } showModal (event = null) { + const openClass = this.config.openClass.split(' ') this.activeElement = document.activeElement this.modal.setAttribute('aria-hidden', 'false') - this.modal.classList.add(this.config.openClass) + this.modal.classList.add(...openClass) this.scrollBehaviour('disable') this.addEventListeners() @@ -85,14 +86,14 @@ const MicroModal = (() => { } this.config.onClose(this.modal, this.activeElement, event) + let openClass = this.config.openClass.split(' ') // <- old school ftw if (this.config.awaitCloseAnimation) { - let openClass = this.config.openClass // <- old school ftw this.modal.addEventListener('animationend', function handler () { - modal.classList.remove(openClass) + modal.classList.remove(...openClass) modal.removeEventListener('animationend', handler, false) }, false) } else { - modal.classList.remove(this.config.openClass) + modal.classList.remove(...openClass) } }