mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 10:19:15 +03:00
32 lines
758 B
JavaScript
32 lines
758 B
JavaScript
export class Modal {
|
|
constructor(id, open, close) {
|
|
this.$el = document.getElementById(id);
|
|
this.open = document.getElementById(open);
|
|
this.close = document.getElementById(close);
|
|
this.init();
|
|
}
|
|
|
|
init() {
|
|
if (this.open) {
|
|
this.setElems();
|
|
this.open.addEventListener('click', this.show.bind(this));
|
|
this.close.addEventListener('click', this.hide.bind(this));
|
|
}
|
|
}
|
|
|
|
show(e) {
|
|
this.$el.classList.remove('hide');
|
|
document.body.style.overflowY = 'hidden';
|
|
this.openHandler(e);
|
|
}
|
|
|
|
hide() {
|
|
this.$el.classList.add('hide');
|
|
document.body.style.overflowY = '';
|
|
}
|
|
|
|
openHandler() {}
|
|
|
|
setElems() {}
|
|
}
|