Interface OverlayOptions

interface OverlayOptions {
    data?: Record<string, string>;
    id?: string;
    parent?: HTMLElement;
    style?: Record<string, string>;
}

Properties

Properties

data?: Record<string, string>

Every entry in this object will be set as a data attribute on the new overlay.

Keys can be either kebab-case or camelCase (they will be converted if needed). Do not include the "data-" prefix which will be added automatically. E.g. both "foo-bar" and "fooBar" will result in "data-foo-bar" being set.

id?: string

If set, then it will be assigned as the DOM element ID for the new overlay.

Furthermore, the new overlay will be created and will not be saved for future reuse.

By default, if id is not given, the overlay will be saved, and if createOverlay is called again with the same style, data and parent, the previous overlay is returned.

parent?: HTMLElement

The parent element to insert the overlay into.

If not given, then:

style?: Record<string, string>

Every entry in this object will be set on the style of the new overlay.

IMPORTANT: By default overlays are positioned absolutely, so if you need another positioning, override this here by setting a position key in style. If position is either "absolute" (by default or explicitly set) or "fixed", and none of top or bottom is given, top: 0 is set; and similarly, if none of left or right is given, left: 0 is set.