Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a7e9e58

Browse files
committedOct 21, 2020
Allow adding multiple space-separated classes for openClass
1 parent 4d03e7e commit a7e9e58

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎lib/src/index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ const MicroModal = (() => {
5656
}
5757

5858
showModal (event = null) {
59+
const openClass = this.config.openClass.split(' ')
5960
this.activeElement = document.activeElement
6061
this.modal.setAttribute('aria-hidden', 'false')
61-
this.modal.classList.add(this.config.openClass)
62+
this.modal.classList.add(...openClass)
6263
this.scrollBehaviour('disable')
6364
this.addEventListeners()
6465

@@ -85,14 +86,14 @@ const MicroModal = (() => {
8586
}
8687
this.config.onClose(this.modal, this.activeElement, event)
8788

89+
let openClass = this.config.openClass.split(' ') // <- old school ftw
8890
if (this.config.awaitCloseAnimation) {
89-
let openClass = this.config.openClass // <- old school ftw
9091
this.modal.addEventListener('animationend', function handler () {
91-
modal.classList.remove(openClass)
92+
modal.classList.remove(...openClass)
9293
modal.removeEventListener('animationend', handler, false)
9394
}, false)
9495
} else {
95-
modal.classList.remove(this.config.openClass)
96+
modal.classList.remove(...openClass)
9697
}
9798
}
9899

0 commit comments

Comments
 (0)
Please sign in to comment.