3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
11 <link rel=
"import" href=
"../polymer/polymer.html">
12 <link rel=
"import" href=
"iron-overlay-manager.html">
15 `iron-overlay-backdrop` is a backdrop used by `Polymer.IronOverlayBehavior`. It should be a
20 The following custom properties and mixins are available for styling.
22 Custom property | Description | Default
23 -------------------------------------------|------------------------|---------
24 `--iron-overlay-backdrop-background-color` | Backdrop background color | #000
25 `--iron-overlay-backdrop-opacity` | Backdrop opacity | 0.6
26 `--iron-overlay-backdrop` | Mixin applied to `iron-overlay-backdrop`. | {}
27 `--iron-overlay-backdrop-opened` | Mixin applied to `iron-overlay-backdrop` when it is displayed | {}
30 <dom-module id=
"iron-overlay-backdrop">
40 background-color: var(--iron-overlay-backdrop-background-color, #
000);
42 transition: opacity
0.2s;
44 @apply(--iron-overlay-backdrop);
48 opacity: var(--iron-overlay-backdrop-opacity,
0.6);
50 @apply(--iron-overlay-backdrop-opened);
67 is
: 'iron-overlay-backdrop',
72 * Returns true if the backdrop is opened.
76 reflectToAttribute
: true,
83 value
: Polymer
.IronOverlayManager
89 * Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
92 if (!this.parentNode
) {
93 Polymer
.dom(document
.body
).appendChild(this);
94 this.style
.zIndex
= this._manager
.currentOverlayZ() - 1;
99 * Shows the backdrop if needed.
102 // only need to make the backdrop visible if this is called by the first overlay with a backdrop
103 if (this._manager
.getBackdrops().length
< 2) {
104 this._setOpened(true);
109 * Hides the backdrop if needed.
112 // only need to make the backdrop invisible if this is called by the last overlay with a backdrop
113 if (this._manager
.getBackdrops().length
< 2) {
114 this._setOpened(false);
119 * Removes the backdrop from document body if needed.
121 complete: function() {
122 // only remove the backdrop if there are no more overlays with backdrops
123 if (this._manager
.getBackdrops().length
=== 0 && this.parentNode
) {
124 Polymer
.dom(this.parentNode
).removeChild(this);