Configures default attributes for new overlays.
All options for up.layer.open()
may be configured.
The configuration will also be used for [up-layer=new]
links.
Defaults are configured separately for each layer mode:
Object | Effect |
---|---|
up.layer.config.root |
Defaults for the root layer |
up.layer.config.modal |
Defaults for modal overlays |
up.layer.config.drawer |
Defaults for drawer overlays |
up.layer.config.popup |
Defaults for popup overlays |
up.layer.config.cover |
Defaults for cover overlays |
For convenience you may configure options that affect all layer modes or all overlay modes:
Object | Effect |
---|---|
up.layer.config.any |
Defaults for all layers |
up.layer.config.overlay |
Defaults for all overlays |
Options configured in such a way are inherited.
E.g. when you open a new drawer overlay, defaults from up.layer.config.drawer
,
up.layer.config.overlay
and up.layer.config.any
will be used (in decreasing priority).
To make all modal overlays move in from beyond the top edge of the screen:
up.layer.config.modal.openAnimation = 'move-from-top'
To configure an additional main target for overlay of any mode:
up.layer.config.overlay.mainTargets.unshift('.content')
The default mode used when opening a new overlay.
Defaults for all layer modes.
An array of CSS selectors matching default render targets.
This is an alias for up.fragment.config.mainTargets
.
Defaults for the root layer.
Inherits from up.layer.config.any
.
An array of CSS selectors matching default render targets for the root layer, but not for overlays.
Defaults for all overlays.
In addition to the options documented here,
all options for up.layer.open()
may also be configured.
Inherits from up.layer.config.any
.
The opening animation.
The duration of the opening animation.
The easing function for the opening animation.
The closing animation.
The duration of the closing animation.
The easing function for the opening animation.
The symbol for the dismiss icon in the top-right corner.
The accessibility label for the dismiss icon in the top-right corner.
Whether the layer's location or title will be visible in the browser's address bar and window title.
If set to 'auto'
, the overlay will render history if its initial fragment
is an auto history target.
If set to true
, the overlay will always render history.
If set to false
, the overlay will never render history.
An HTML class for the overlay's container element.
See overlay classes.
Defaults for modal overlays.
Inherits from up.layer.config.overlay
and up.layer.config.any
.
Defaults for cover overlays.
Inherits from up.layer.config.overlay
and up.layer.config.any
.
Defaults for drawer overlays.
Inherits from up.layer.config.overlay
and up.layer.config.any
.
Defaults for popup overlays.
Inherits from up.layer.config.overlay
and up.layer.config.any
.
An array of CSS selectors matching overlays not constructed by Unpoly.
Other JavaScript libraries often attach their overlay elements
to the end of the <body>
, which makes Unpoly consider these overlays
to be part of the root layer. This can cause Unpoly to steal focus from foreign
overlays, or cause Unpoly overlays to incorrectly close when the foreign overlay is clicked.
Adding a selector to this array will cause Unpoly to
be less opinionated about user interactions within matching elements.
By default this contains a selector matching the
<dialog>
element.