| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 @license | |
| 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.g
ithub.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/CONTRI
BUTORS.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/PATEN
TS.txt | |
| 9 --><html><head><link rel="import" href="../../polymer/polymer.html"> | |
| 10 <link rel="import" href="../../iron-flex-layout/iron-flex-layout.html"> | |
| 11 <link rel="import" href="../../iron-resizable-behavior/iron-resizable-behavior.h
tml"> | |
| 12 <link rel="import" href="../app-scroll-effects/app-scroll-effects-behavior.html"
> | |
| 13 | |
| 14 <!-- | |
| 15 app-box is a container element that can have scroll effects - visual effects bas
ed on | |
| 16 scroll position. For example, the parallax effect can be used to move an image a
t a slower | |
| 17 rate than the foreground. | |
| 18 | |
| 19 ```html | |
| 20 <app-box style="height: 100px;" effects="parallax-background"> | |
| 21 <img background src="picture.png" style="width: 100%; height: 600px;"> | |
| 22 </app-box> | |
| 23 ``` | |
| 24 | |
| 25 Notice the `background` attribute in the `img` element; this attribute specifies
that that image is used as the background. | |
| 26 By adding the background to the light dom, you can compose backgrounds that can
change dynamically. | |
| 27 Alternatively, the mixin `--app-box-background-front-layer` allows to style the
background. For example: | |
| 28 | |
| 29 ```css | |
| 30 .parallaxAppBox { | |
| 31 --app-box-background-front-layer: { | |
| 32 background-image: url(picture.png); | |
| 33 }; | |
| 34 } | |
| 35 ``` | |
| 36 | |
| 37 Finally, app-box can have content inside. For example: | |
| 38 | |
| 39 ```html | |
| 40 <app-box effects="parallax-background"> | |
| 41 <h2>Sub title</h2> | |
| 42 </app-box> | |
| 43 ``` | |
| 44 | |
| 45 ## Scroll effects | |
| 46 | |
| 47 Effect name | Description | |
| 48 ----------------|------------- | |
| 49 `parallax-background` | A parallax effect | |
| 50 | |
| 51 ## Styling | |
| 52 | |
| 53 Mixin | Description | Default | |
| 54 ----------------|-------------|---------- | |
| 55 `--app-box-background-front-layer` | Applies to the front layer of the backgroun
d | {} | |
| 56 | |
| 57 @group App Elements | |
| 58 @element app-box | |
| 59 @demo app-box/demo/document-scroll.html Document Scroll | |
| 60 @demo app-box/demo/scrolling-region.html Scrolling Region | |
| 61 --> | |
| 62 | |
| 63 </head><body><dom-module id="app-box"> | |
| 64 <template> | |
| 65 <style> | |
| 66 :host { | |
| 67 position: relative; | |
| 68 | |
| 69 display: block; | |
| 70 } | |
| 71 | |
| 72 #background { | |
| 73 @apply(--layout-fit); | |
| 74 | |
| 75 overflow: hidden; | |
| 76 | |
| 77 height: 100%; | |
| 78 } | |
| 79 | |
| 80 #backgroundFrontLayer { | |
| 81 min-height: 100%; | |
| 82 | |
| 83 pointer-events: none; | |
| 84 | |
| 85 background-size: cover; | |
| 86 | |
| 87 @apply(--app-box-background-front-layer); | |
| 88 } | |
| 89 | |
| 90 #contentContainer { | |
| 91 position: relative; | |
| 92 | |
| 93 width: 100%; | |
| 94 height: 100%; | |
| 95 } | |
| 96 | |
| 97 :host([disabled]), | |
| 98 :host([disabled]) #backgroundFrontLayer { | |
| 99 transition: none !important; | |
| 100 } | |
| 101 </style> | |
| 102 | |
| 103 <div id="background"> | |
| 104 <div id="backgroundFrontLayer"> | |
| 105 <content select="[background]"></content> | |
| 106 </div> | |
| 107 </div> | |
| 108 <div id="contentContainer"> | |
| 109 <content id="content"></content> | |
| 110 </div> | |
| 111 </template> | |
| 112 | |
| 113 </dom-module> | |
| 114 <script src="app-box-extracted.js"></script></body></html> | |
| OLD | NEW |