diff options
Diffstat (limited to 'src/lightbox.js')
| -rw-r--r-- | src/lightbox.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lightbox.js b/src/lightbox.js index d5db91d..3b25585 100644 --- a/src/lightbox.js +++ b/src/lightbox.js @@ -5,6 +5,12 @@ import Shadow from './shadow.js'; export default class LightBox { overlay = new Overlay(); + /** + * ============ + * Initializers + * ============ + */ + constructor({ container }) { this.container = container; this.init(); @@ -42,10 +48,17 @@ export default class LightBox { }); } + /** + * ============ + * Actions + * ============ + */ + openLightBox(image) { - const shadow = new Shadow(image); + const shadow = Shadow.find(image) || new Shadow(image); + shadow.open(); + this.overlay.add(shadow); this.overlay.show(); - shadow.open(); } } |
