---
name: "up.Layer.prototype.isAlive"
area: "API"
kind: "Instance method"
parent: "up.Layer class"
url: "https://unpoly.com/api/up.Layer.prototype.isAlive"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.Layer class](https://unpoly.com/api/up.Layer.md)</nav>

# up.Layer.prototype.isAlive()

Returns whether this layer is part of the [layer stack](https://unpoly.com/api/up.layer.stack.md) and can be interacted with.

<nav aria-label="Contents">

#### Contents

- [When a layer is alive](#when-a-layer-is-alive)
- [See also](#see-also)
- [Return value](#return-value)

</nav>

## When a layer is alive {#when-a-layer-is-alive}

A layer that is alive can be [targeted](https://unpoly.com/learn/targeting-fragments.md) with fragment changes, or [queried](https://unpoly.com/api/up.fragment.get.md) for containing elements.

The [root layer](https://unpoly.com/learn/overlays.md#layer-modes) is always alive. An overlay is alive as soon as it enters the DOM, even when it is still playing its opening animation.

An overlay stops being alive as soon as it starts [closing](https://unpoly.com/learn/closing-overlays.md), even while its closing animation is still playing.

| Overlay state | `up.Layer#isAlive()` |
| --- | --- |
| Entered DOM | `true` |
| Opening animation playing | `true` |
| Opened | `true` |
| Closing animation playing | `false` |
| Removed from DOM | `false` |

## See also {#see-also}

- The [`.up-destroying`](https://unpoly.com/api/up-destroying.md) class is automatically assigned to elements in their exit animation.
- All [`up.fragment`](https://unpoly.com/api/up.fragment.md) functions (like [`up.fragment.get()`](https://unpoly.com/api/up.fragment.get.md)) ignore elements in their exit animation.
- The [`up.fragment.isAlive()`](https://unpoly.com/api/up.fragment.isAlive.md) function checks if an element is attached to the DOM and also not in an exit animation.

---

## Return value {#return-value}

Whether this layer is considered alive.

Type: boolean

