| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 6 Code distributed by Google as part of the polymer project is also | 6 Code distributed by Google as part of the polymer project is also |
| 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 8 --> | 8 --> |
| 9 | 9 |
| 10 <link rel="import" href="../polymer/polymer.html"> | 10 <link rel="import" href="../polymer/polymer.html"> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 Mode | Description | 60 Mode | Description |
| 61 ----------------|------------- | 61 ----------------|------------- |
| 62 `standard` | The header is a step above the panel. The header will consume the p
anel at the point of entry, preventing it from passing through to the opposite s
ide. | 62 `standard` | The header is a step above the panel. The header will consume the p
anel at the point of entry, preventing it from passing through to the opposite s
ide. |
| 63 `seamed` | The header is presented as seamed with the panel. | 63 `seamed` | The header is presented as seamed with the panel. |
| 64 `waterfall` | Similar to standard mode, but header is initially presented as sea
med with panel, but then separates to form the step. | 64 `waterfall` | Similar to standard mode, but header is initially presented as sea
med with panel, but then separates to form the step. |
| 65 `waterfall-tall` | The header is initially taller (`tall` class is added to the
header). As the user scrolls, the header separates (forming an edge) while conde
nsing (`tall` class is removed from the header). | 65 `waterfall-tall` | The header is initially taller (`tall` class is added to the
header). As the user scrolls, the header separates (forming an edge) while conde
nsing (`tall` class is removed from the header). |
| 66 `scroll` | The header keeps its seam with the panel, and is pushed off screen. | 66 `scroll` | The header keeps its seam with the panel, and is pushed off screen. |
| 67 `cover` | The panel covers the whole `paper-header-panel` including the header.
This allows user to style the panel in such a way that the panel is partially co
vering the header. | 67 `cover` | The panel covers the whole `paper-header-panel` including the header.
This allows user to style the panel in such a way that the panel is partially co
vering the header. |
| 68 | 68 |
| 69 Example: | 69 Example: |
| 70 | 70 |
| 71 <paper-header-panel mode="waterfall"> | 71 <paper-header-panel mode="waterfall"> |
| 72 <div class="paper-header">standard</div> | 72 <div class="paper-header">standard</div> |
| 73 <div class="content fit">content fits 100% below the header</div> | 73 <div class="content fit">content fits 100% below the header</div> |
| 74 </paper-header-panel> | 74 </paper-header-panel> |
| 75 | 75 |
| 76 | 76 |
| 77 Styling header panel: | 77 Styling header panel: |
| 78 | 78 |
| 79 To change the shadow that shows up underneath the header: | 79 To change the shadow that shows up underneath the header: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 @apply(--layout-vertical); | 120 @apply(--layout-vertical); |
| 121 | 121 |
| 122 display: block; | 122 display: block; |
| 123 position: relative; | 123 position: relative; |
| 124 height: 100%; | 124 height: 100%; |
| 125 | 125 |
| 126 /* Create a stack context, we will need it for the shadow*/ | 126 /* Create a stack context, we will need it for the shadow*/ |
| 127 z-index: 0; | 127 z-index: 0; |
| 128 } | 128 } |
| 129 | 129 |
| 130 :root { |
| 131 /** |
| 132 * Default paper header panel shadow |
| 133 */ |
| 134 --paper-header-panel-shadow: { |
| 135 height: 6px; |
| 136 bottom: -6px; |
| 137 box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4); |
| 138 }; |
| 139 } |
| 140 |
| 130 #mainContainer { | 141 #mainContainer { |
| 131 @apply(--layout-flex); | 142 @apply(--layout-flex); |
| 132 | 143 |
| 133 position: relative; | 144 position: relative; |
| 134 overflow-y: auto; | 145 overflow-y: auto; |
| 135 overflow-x: hidden; | 146 overflow-x: hidden; |
| 136 -webkit-overflow-scrolling: touch; | 147 -webkit-overflow-scrolling: touch; |
| 137 flex-basis: 0.0001px; | 148 flex-basis: 0.0001px; |
| 138 } | 149 } |
| 139 | 150 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 234 |
| 224 <template> | 235 <template> |
| 225 <content id="headerContent" select="paper-toolbar, .paper-header"></content> | 236 <content id="headerContent" select="paper-toolbar, .paper-header"></content> |
| 226 <div id="mainContainer" class$="[[_computeMainContainerClass(mode)]]"> | 237 <div id="mainContainer" class$="[[_computeMainContainerClass(mode)]]"> |
| 227 <content id="mainContent" select="*"></content> | 238 <content id="mainContent" select="*"></content> |
| 228 </div> | 239 </div> |
| 229 </template> | 240 </template> |
| 230 | 241 |
| 231 </dom-module> | 242 </dom-module> |
| 232 | 243 |
| 233 <style is="custom-style"> | |
| 234 :root { | |
| 235 /** | |
| 236 * Default paper header panel shadow | |
| 237 */ | |
| 238 --paper-header-panel-shadow: { | |
| 239 height: 6px; | |
| 240 bottom: -6px; | |
| 241 box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4); | |
| 242 }; | |
| 243 } | |
| 244 </style> | |
| 245 | |
| 246 <script> | 244 <script> |
| 247 | 245 |
| 248 (function() { | 246 (function() { |
| 249 | 247 |
| 250 'use strict'; | 248 'use strict'; |
| 251 | 249 |
| 252 var SHADOW_WHEN_SCROLLING = 1; | 250 var SHADOW_WHEN_SCROLLING = 1; |
| 253 var SHADOW_ALWAYS = 2; | 251 var SHADOW_ALWAYS = 2; |
| 254 | 252 |
| 255 | 253 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 var header = this.header; | 449 var header = this.header; |
| 452 var animateDuration = 200; | 450 var animateDuration = 200; |
| 453 | 451 |
| 454 if (header) { | 452 if (header) { |
| 455 // in tallMode it may add tallClass to the header; so do the cleanup | 453 // in tallMode it may add tallClass to the header; so do the cleanup |
| 456 // when mode is changed from tallMode to not tallMode | 454 // when mode is changed from tallMode to not tallMode |
| 457 if (configs.tallMode[oldMode] && !configs.tallMode[newMode]) { | 455 if (configs.tallMode[oldMode] && !configs.tallMode[newMode]) { |
| 458 header.classList.remove(this.tallClass); | 456 header.classList.remove(this.tallClass); |
| 459 this.async(function() { | 457 this.async(function() { |
| 460 header.classList.remove('animate'); | 458 header.classList.remove('animate'); |
| 461 }, null, animateDuration); | 459 }, animateDuration); |
| 462 } else { | 460 } else { |
| 463 header.classList.toggle('animate', configs.tallMode[newMode]); | 461 header.classList.toggle('animate', configs.tallMode[newMode]); |
| 464 } | 462 } |
| 465 } | 463 } |
| 466 this._keepScrollingState(); | 464 this._keepScrollingState(); |
| 467 }, | 465 }, |
| 468 | 466 |
| 469 _keepScrollingState: function () { | 467 _keepScrollingState: function () { |
| 470 var main = this.scroller; | 468 var main = this.scroller; |
| 471 var header = this.header; | 469 var header = this.header; |
| 472 | 470 |
| 473 this._setAtTop(main.scrollTop === 0); | 471 this._setAtTop(main.scrollTop === 0); |
| 474 | 472 |
| 475 if (header && MODE_CONFIGS.tallMode[this.mode]) { | 473 if (header && MODE_CONFIGS.tallMode[this.mode]) { |
| 476 this.toggleClass(this.tallClass, this.atTop || | 474 this.toggleClass(this.tallClass, this.atTop || |
| 477 header.classList.contains(this.tallClass) && | 475 header.classList.contains(this.tallClass) && |
| 478 main.scrollHeight < this.offsetHeight, header); | 476 main.scrollHeight < this.offsetHeight, header); |
| 479 } | 477 } |
| 480 }, | 478 }, |
| 481 | 479 |
| 482 _scroll: function(e) { | 480 _scroll: function(e) { |
| 483 this._keepScrollingState(); | 481 this._keepScrollingState(); |
| 484 this.fire('content-scroll', {target: this.scroller}, this, false); | 482 this.fire('content-scroll', {target: this.scroller}, {bubbles: false}); |
| 485 }, | 483 }, |
| 486 | 484 |
| 487 _getScrollerForMode: function(mode) { | 485 _getScrollerForMode: function(mode) { |
| 488 return MODE_CONFIGS.outerScroll[mode] ? | 486 return MODE_CONFIGS.outerScroll[mode] ? |
| 489 this : this.$.mainContainer; | 487 this : this.$.mainContainer; |
| 490 } | 488 } |
| 491 | 489 |
| 492 }); | 490 }); |
| 493 | 491 |
| 494 })(); | 492 })(); |
| 495 | 493 |
| 496 </script> | 494 </script> |
| OLD | NEW |