-
Notifications
You must be signed in to change notification settings - Fork 0
/
Modal.js
35 lines (30 loc) · 1.04 KB
/
Modal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
export default class Modal {
_id = undefined;
_display = undefined;
constructor(id) {
this._id = id;
this._display = document.getElementById(`${this._id}-content`);
if (window.MicroModal.initialized === undefined) {
this.initMicroModal();
window.MicroModal.initialized = true;
}
}
show(options) {
this._display.innerHTML = options.message;
MicroModal.show(this._id, options);
}
initMicroModal() {
MicroModal.init({
//onShow: modal => console.info(`${modal.id} is shown`), // [1]
//onClose: modal => console.info(`${modal.id} is hidden`), // [2]
//openTrigger: 'data-custom-open', // [3]
//closeTrigger: 'data-custom-close', // [4]
openClass: 'is-open', // [5]
disableScroll: true, // [6]
disableFocus: false, // [7]
awaitOpenAnimation: true, // [8]
awaitCloseAnimation: true, // [9]
debugMode: false // [10]
});
}
}