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;
40 background-color: tomato;
47 background-color: tomato;
53 <body unresolved fullbleed vertical layout
>
54 <template is=
"auto-binding">
55 <core-toolbar class=
"toolbar">
56 <core-icon-button icon=
"{{$.pages.selected != 0 ? 'arrow-back' : 'menu'}}" on-tap=
"{{back}}"></core-icon-button>
58 <core-icon-button icon=
"more-vert"></core-icon-button>
60 <core-animated-pages id=
"pages" flex
selected=
"0" on-core-animated-pages-transition-end=
"{{transitionend}}" transitions=
"cross-fade-all hero-transition">
62 <section vertical layout
>
64 <div id=
"container" flex horizontal wrap around-justified layout hero-p
>
65 <template repeat=
"{{item in items}}">
66 <div class=
"card" vertical center center-justified layout
hero-id=
"item-{{item}}" hero?=
"{{$.pages.selected === item + 1 || lastSelected === item + 1}}" on-tap=
"{{selectView}}"><span cross-fade
>{{item}}
</span></div>
72 <template repeat=
"{{item in items}}">
73 <section vertical layout
>
74 <div class=
"view" flex vertical center center-justified layout
hero-id=
"item-{{item}}" hero?=
"{{$.pages.selected === item + 1 || $.pages.selected === 0}}"><span cross-fade
>{{item}}
</span></div>
78 </core-animated-pages>
83 addEventListener('template-bound', function(e
) {
85 var items
= [], count
=50;
86 for (var i
=0; i
< count
; i
++) {
92 scope
.selectView = function(e
) {
93 var i
= e
.target
.templateInstance
.model
.item
;
94 this.$.pages
.selected
= i
+1;
97 scope
.back = function() {
98 this.lastSelected
= this.$.pages
.selected
;
99 console
.log(this.lastSelected
);
100 this.$.pages
.selected
= 0;
103 scope
.transitionend = function() {
104 if (this.lastSelected
) {
105 this.lastSelected
= null;