1 <!doctype html> 2 <!-- 3 @license 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 5 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 7 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 8 Code distributed by Google as part of the polymer project is also 9 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10 --> 11 <html> 12 <head> 13 <title>paper-material demo</title> 14 15 <meta charset="utf-8"> 16 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 17 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> 18 19 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> 20 <link rel="import" href="../../iron-demo-helpers/demo-snippet.html"> 21 <link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html"> 22 <link rel="import" href="../paper-material.html"> 23 24 <style is="custom-style" include="demo-pages-shared-styles"> 25 paper-material { 26 display: inline-block; 27 background: white; 28 box-sizing: border-box; 29 margin: 8px; 30 padding: 16px; 31 border-radius: 2px; 32 } 33 </style> 34 </head> 35 <body unresolved> 36 <div class="vertical-section-container centered"> 37 <h3>Paper-materials can have different elevations</h3> 38 <demo-snippet class="centered-demo"> 39 <template> 40 <paper-material elevation="0">0</paper-material> 41 <paper-material elevation="1">1</paper-material> 42 <paper-material elevation="2">2</paper-material> 43 <paper-material elevation="3">3</paper-material> 44 <paper-material elevation="4">4</paper-material> 45 <paper-material elevation="5">5</paper-material> 46 </template> 47 </demo-snippet> 48 49 <h3>Changes in elevation can be animated</h3> 50 <demo-snippet class="centered-demo"> 51 <template> 52 <style> 53 #a1, #a2 { cursor: pointer; } 54 </style> 55 Tap each of these boxes! 56 <div> 57 <paper-material elevation="0" animated id="a1">animated</paper-material> 58 <paper-material elevation="3" id="a2">not animated</paper-material> 59 </div> 60 <script> 61 document.addEventListener('WebComponentsReady', function() { 62 a1.addEventListener('click', _onTap); 63 a2.addEventListener('click', _onTap); 64 }); 65 function _onTap(e) { 66 var target = e.target; 67 if (!target.down) { 68 target.elevation += 1; 69 if (target.elevation === 5) { 70 target.down = true; 71 } 72 } else { 73 target.elevation -= 1; 74 if (target.elevation === 0) { 75 target.down = false; 76 } 77 } 78 }; 79 </script> 80 </template> 81 </demo-snippet> 82 </div> 83 </body> 84 </html> 85