up.layer
Features to open, close and look up overlays.
Add [up-layer=new] to a link or form to show its response in a new overlay, or open one from JavaScript with up.layer.open(). An overlay closes when the user dismisses it, or when an [up-accept] link or form closes it with a result value. up.layer.ask() opens an overlay and returns a promise for that value, so a subinteraction reads like a function call.
up.layer.current is the layer your code is working with, and most functions in this module operate on it: up.layer.on() listens to events from the current layer only, and up.layer.dismiss() closes it. The layers themselves are up.Layer objects, listed in up.layer.stack.
Accepts the current layer when this element is clicked or submitted.
When this element is clicked, closes a currently open overlay.
Dismisses the current layer when this element is clicked or submitted.
Clicking this link will load the destination and open the given selector in a drawer overlay that slides in from the edge of the screen.
Accepts the current layer.
This event is emitted before a layer is accepted.
This event is emitted after a layer was accepted.
Creates an element with the given selector and appends it to the current layer's content.
Opens an overlay and returns a promise for its acceptance.
Configures default attributes for new overlays.
Returns whether the given element is contained by the current layer.
The context of the current layer.
Returns the number of layers in the layer stack.
Returns the current layer in the layer stack.
Dismisses the current layer.
This event is emitted before a layer is dismissed.
This event is emitted after a layer was dismissed.
Dismisses all overlays.
The outmost element of the current layer.
Emits an event on the current layer's element.
Returns the frontmost layer in the layer stack.
Returns an up.Layer object for the given element or layer option.
Returns an array of up.Layer objects matching the given layer option.
Whether the current layer has visible history.
Returns whether the current layer is the frontmost layer.
Returns whether the current layer is not the root layer.
Returns whether the current layer is the root layer.
The location URL of the current layer.
This event is emitted after a layer's location property has changed value.
The current layer's mode, which governs its appearance and behavior.
Shows the response to a link click or form submission within a new overlay.
Unbinds an event listener previously bound to the current layer.
Listens to a DOM event that originated on an element contained by the current layer.
Opens a new overlay.
This event is emitted before an overlay is opened.
This event is emitted after a new overlay was placed into the DOM.
Returns an array of all overlays.
Returns the parent layer of the current layer.
Returns the root layer.
The size of the current layer.
A list of layers that are currently open.
Clicking this link will load the destination and open the given selector in a modal overlay.
Closes a currently open overlay.
Sets default options for future modal overlays.
Returns whether the given element or selector is contained within the current layer.
Returns the location URL of the layer behind the current overlay.
Extracts the given CSS selector from the given HTML string and opens the results in a modal overlay.
Opens the given link's destination in a modal overlay.
Returns whether an overlay is currently open.
Returns the location URL of the fragment displayed in the current overlay.
Opens a modal overlay for the given URL.
Clicking this link will load the destination and open the given selector in a popup overlay.
Attaches a popup overlay to the given element or selector.
Closes a currently open overlay.
Sets default options for future popup overlays.
Returns whether the given element or selector is contained within the current layer.
Returns the location URL of the layer behind the current overlay.
Returns whether an overlay is currently open.
Returns the location URL of the fragment displayed in the current overlay.
Tip Your coding agent can search these docs locally with the Unpoly agent skill