This feature is experimental. Please share your experiences so we know what to keep or change.
Your target selectors may use this pseudo-selector to replace the layer's topmost swappable element.
The topmost swappable element is the first child of the layer's container element:
<body>
element.{ target }
that the overlay was opened with.Use :layer
to replace all visible elements of a layer. To only update a layer's main content area
while keeping static layout elements around it, see :main
.
We open an overlay with a target selector #target
:
up.layer.open({ target: '#foo', content: 'Hello from overlay' })
The topmost swappable element is now #foo
, which we can select with :layer
:
// targets '#foo`'
up.render({ target: ':layer', url: '/page2' })
The resolution of :target
depends on the targeted layer. For example, when rendering in
the root layer, :target
will resolve to the <body>
:
// targets the body
up.render({ target: ':layer', layer: 'root', url: '/page2' })