summaryrefslogtreecommitdiff
path: root/src/overlay.js
blob: 613340cd04298fafb75174e954918cc194fc0c2b (plain)
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
export default class Overlay {
  zIndex = 900;
  zIndexHidden = -100;

  constructor() {
    const overlay = document.createElement('div');
    overlay.id = 'libra-overlay';
    overlay.classList.add('libra-overlay');

    // initialized state
    overlay.style.zIndex = this.zIndexHidden;
    overlay.style.opacity = '0';

    this.element = overlay;
    document.body.appendChild(overlay);

    return this;
  }

  show() {
    this.element.style.opacity = '1';
    this.element.style.zIndex = this.zIndex;
  }

  hide() {
    this.element.style.opacity = '0';
    this.element.style.zIndex = '-100';
  }
}