diff options
| author | Eltrac <hi@guhub.cn> | 2025-09-17 22:21:49 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-09-17 22:21:49 +0800 |
| commit | 5572b1847a70793d64d63792efc2371ad9948f0e (patch) | |
| tree | 9516b05c8a30a9573beb3beb25d322ea78f9d3f2 | |
| parent | 6c0220a4fa9c1c31b876db4addac29cbb3e2e5a0 (diff) | |
fix: lightbox does not close when moving on touchscreen
| -rw-r--r-- | src/lightbox.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lightbox.js b/src/lightbox.js index 2bd242b..bef29eb 100644 --- a/src/lightbox.js +++ b/src/lightbox.js @@ -41,14 +41,12 @@ export default class LightBox { initControls() { // keyboard shortcuts document.addEventListener('keydown', e => { - if (e.key === 'Escape' || e.key === ' ') { + if (e.key === 'Escape' || e.key === ' ') this.closeCurrent(); - } }); // scroll to dismiss - document.body.addEventListener('wheel', e => { - this.closeCurrent(); - }); + document.body.addEventListener('wheel', e => this.closeCurrent()); + document.body.addEventListener('touchmove', e => this.closeCurrent()); } /** |
