1<!doctype html> 2<!-- 3@license 4Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 5This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt 6The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 7The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt 8Code distributed by Google as part of the polymer project is also 9subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt 10--> 11<html> 12 <head> 13 <title>neon-animated-pages demo: dropdown</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 21 <link rel="import" href="../../neon-animated-pages.html"> 22 <link rel="import" href="../../neon-animations.html"> 23 <link rel="import" href="animated-dropdown.html"> 24 25 </head> 26 <body> 27 28 <template is="dom-bind"> 29 30 <button dropdown-id="dropdown" on-click="_onButtonClick">dropdown</button> 31 <br> 32 <animated-dropdown id="dropdown" on-click="_onDropdownClick">Hello world!</animated-dropdown> 33 34 </template> 35 36 <script> 37 38 var scope = document.querySelector('template[is="dom-bind"]'); 39 40 scope._onButtonClick = function(event) { 41 var dropdown = document.querySelector('#' + event.target.getAttribute('dropdown-id')); 42 if (dropdown) { 43 dropdown.show(); 44 } 45 }; 46 47 scope._onDropdownClick = function(event) { 48 event.target.hide(); 49 }; 50 51 </script> 52 53 </body> 54</html> 55