3 Copyright (c) 2014 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
14 <script src=
"../../webcomponentsjs/webcomponents.js"></script>
16 <link href=
"../../core-icons/core-icons.html" rel=
"import">
17 <link href=
"../../core-icon-button/core-icon-button.html" rel=
"import">
18 <link href=
"../../core-toolbar/core-toolbar.html" rel=
"import">
19 <link href=
"../core-animated-pages.html" rel=
"import">
23 font-family: sans-serif;
27 background-color: steelblue;
33 <body unresolved fullbleed vertical layout
>
35 <polymer-element name=
"grid-toc" attributes=
"items selected">
48 background-color: tomato;
53 <div id=
"container" on-tap=
"{{selectView}}" flex horizontal wrap around-justified layout hero-p
>
54 <template repeat=
"{{item in items}}">
55 <div class=
"card" vertical center center-justified layout
hero-id=
"item-{{item}}" hero?=
"{{selected === item + 1 || lastSelected === item + 1}}"><span cross-fade
>{{item}}
</span></div>
61 selectedChanged: function(old
) {
62 this.lastSelected
= old
;
64 selectView: function(e
) {
65 var item
= e
.target
.templateInstance
.model
.item
;
66 if (item
!== undefined) {
67 this.fire('grid-toc-select', {item
: item
});
74 <polymer-element name=
"grid-item" attributes=
"item isHero">
79 background-color: tomato;
82 <div class=
"view" flex vertical center center-justified layout
hero-id=
"item-{{item}}" hero?=
"{{isHero}}">
83 <span cross-fade
>{{item}}
</span>
87 Polymer('grid-item', {
94 <template is=
"auto-binding">
95 <core-toolbar class=
"toolbar">
96 <core-icon-button icon=
"{{$.pages.selected != 0 ? 'arrow-back' : 'menu'}}" on-tap=
"{{back}}"></core-icon-button>
98 <core-icon-button icon=
"more-vert"></core-icon-button>
100 <core-animated-pages id=
"pages" flex
selected=
"0" on-core-animated-pages-transition-end=
"{{transitionend}}" transitions=
"cross-fade-all hero-transition">
102 <grid-toc vertical
id=
"toc" layout
selected=
"{{$.pages.selected}}" items=
"{{items}}" hero-p
on-grid-toc-select=
"{{selectView}}"></grid-toc>
104 <template repeat=
"{{item in items}}">
105 <grid-item vertical layout
item=
"{{item}}" hero-p
isHero=
"{{$.pages.selected === item + 1 || $.pages.selected === 0}}"></grid-item>
108 </core-animated-pages>
113 addEventListener('template-bound', function(e
) {
114 var scope
= e
.target
;
115 var items
= [], count
=50;
116 for (var i
=0; i
< count
; i
++) {
122 scope
.selectView = function(e
, detail
) {
124 this.$.pages
.selected
= i
+1;
127 scope
.back = function() {
128 this.lastSelected
= this.$.pages
.selected
;
129 this.$.pages
.selected
= 0;
132 scope
.transitionend = function() {
133 if (this.lastSelected
) {
134 this.lastSelected
= null;