Returns an up.Layer object for the given element or layer option.
Passing an element will return the layer containing that element:
let element = document.querySelector(...)
up.layer.get(element) // returns the element's layer
If the given element is detached or part of a closing overlay, undefined is returned.
Pass a number to return the up.Layer object at that index:
up.layer.get(0) // returns the root layer
up.layer.get(1) // returns the first overlay
Pass any layer option to return the up.Layer object
of the first layer matching that option:
up.layer.get('front') // returns the front layer
To look up one of multiple layer options, separate the values using a comma:
// returns the parent layer, or the root if we're already on root:
up.layer.get('parent, root')
up.Layer objects are returnedPassing an existing up.Layer object will return it unchanged:
let layer = up.layer.root
up.layer.get(layer) // returns the given layer
Passing null or undefined will return the current layer:
up.layer.get(undefined) // returns the current layer
The layer matching the given option.
If no layer matches, undefined is returned.
Tip Your coding agent can search these docs locally with the Unpoly agent skill