This event is emitted before an overlay is opened.
The overlay is not yet part of the layer stack and has not yet been placed in the DOM. Listeners may prevent this event to prevent the overlay from opening.
The event is emitted on the document
.
Listeners may inspect and manipulate options for the overlay that is about to open.
For example, to give overlays the CSS class .warning
if the initial URL contains
the word "confirm"
:
up.on('up:layer:open', function(event) {
if (event.layerOptions.url.includes('confirm')) {
event.layerOptions.class = 'warning'
}
})
Options for the overlay that is about to open.
Listeners may inspect and change the options.
All options for up.layer.open()
may be used.
The link element that is opening the overlay.
Prevents this overlay from opening.
Programmatic callers will reject with an up.AbortError
.