diff --git a/src/overlay.js b/src/overlay.js index 61f5fa88..f231e644 100644 --- a/src/overlay.js +++ b/src/overlay.js @@ -133,14 +133,18 @@ this.elementWrapper.appendChild(this.element); if (this.element.id) { - this.elementWrapper.id = "overlay-wrapper-" + this.element.id; + this.elementWrapper.id = "overlay-wrapper-" + this.element.id; } else { - this.elementWrapper.id = "overlay-wrapper"; + this.elementWrapper.id = "overlay-wrapper-" + crypto.randomUUID(); // Ensure unique ID } + // Always add a class for easier selection + this.elementWrapper.classList.add("openseadragon-overlay-wrapper"); + + this.style = this.elementWrapper.style; this._init(options); - }; + }; /** @lends OpenSeadragon.Overlay.prototype */ $.Overlay.prototype = {