diff options
| author | Eltrac <hi@guhub.cn> | 2025-09-15 11:37:06 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-09-15 11:37:06 +0800 |
| commit | ee6ed655390e6159a57ca1fe1725fd5294e66efb (patch) | |
| tree | 4d0e7e59117d9122fdaa16d40df878ec59573df2 /src/lightbox.js | |
| parent | da471403e72387a004905af11b2bc8ec5db25b62 (diff) | |
fix: generate truly unique IDs
Diffstat (limited to 'src/lightbox.js')
| -rw-r--r-- | src/lightbox.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lightbox.js b/src/lightbox.js index 5523fc7..57922b3 100644 --- a/src/lightbox.js +++ b/src/lightbox.js @@ -1,4 +1,3 @@ -import Utility from './utility.js'; import Overlay from './overlay.js'; import Shadow from './shadow.js'; @@ -21,7 +20,7 @@ export default class LightBox { const images = document.querySelectorAll(`${this.container} img[data-libo]`); images.forEach(image => { - image.id = Utility.hashCode(image.src); // generate unique id for image + image.id = crypto.randomUUID(); // generate unique id for image const link = this.wrapInLink(image); // add event listener to open lightbox on click link.addEventListener('click', e => { |
