| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright (c) 2014 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 | |
| 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 | |
| 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 | |
| 8 --><!-- | |
| 9 | |
| 10 `core-dropdown` is an element that is initially hidden and is positioned relativ
ely to another | |
| 11 element, usually the element that triggers the dropdown. The dropdown and the tr
iggering element | |
| 12 should be children of the same offsetParent, e.g. the same `<div>` with `positio
n: relative`. | |
| 13 It can be used to implement dropdown menus, menu buttons, etc.. | |
| 14 | |
| 15 Example: | |
| 16 | |
| 17 <template is="auto-binding"> | |
| 18 <div relative> | |
| 19 <core-icon-button id="trigger" icon="menu"></core-icon-button> | |
| 20 <core-dropdown relatedTarget="{{$.trigger}}"> | |
| 21 <core-menu> | |
| 22 <core-item>Cut</core-item> | |
| 23 <core-item>Copy</core-item> | |
| 24 <core-item>Paste</core-item> | |
| 25 </core-menu> | |
| 26 </core-dropdown> | |
| 27 </div> | |
| 28 </template> | |
| 29 | |
| 30 Positioning | |
| 31 ----------- | |
| 32 | |
| 33 By default, the dropdown is absolutely positioned on top of the `relatedTarget`
with the top and | |
| 34 left edges aligned. The `halign` and `valign` properties controls the various al
ignments. The size | |
| 35 of the dropdown is automatically restrained such that it is entirely visible on
the screen. Use the | |
| 36 `margin` | |
| 37 | |
| 38 If you need more control over the dropdown's position, use CSS. The `halign` and
`valign` properties are | |
| 39 ignored if the dropdown is positioned with CSS. | |
| 40 | |
| 41 Example: | |
| 42 | |
| 43 <style> | |
| 44 /* manually position the dropdown below the trigger */ | |
| 45 core-dropdown { | |
| 46 position: absolute; | |
| 47 top: 38px; | |
| 48 left: 0; | |
| 49 } | |
| 50 </style> | |
| 51 | |
| 52 <template is="auto-binding"> | |
| 53 <div relative> | |
| 54 <core-icon-button id="trigger" icon="menu"></core-icon-button> | |
| 55 <core-dropdown relatedTarget="{{$.trigger}}"> | |
| 56 <core-menu> | |
| 57 <core-item>Cut</core-item> | |
| 58 <core-item>Copy</core-item> | |
| 59 <core-item>Paste</core-item> | |
| 60 </core-menu> | |
| 61 </core-dropdown> | |
| 62 </div> | |
| 63 </template> | |
| 64 | |
| 65 The `layered` property | |
| 66 ---------------------- | |
| 67 | |
| 68 Sometimes you may need to render the dropdown in a separate layer. For example, | |
| 69 it may be nested inside an element that needs to be `overflow: hidden`, or | |
| 70 its parent may be overlapped by elements above it in stacking order. | |
| 71 | |
| 72 The `layered` property will place the dropdown in a separate layer to ensure | |
| 73 it appears on top of everything else. Note that this implies the dropdown will | |
| 74 not scroll with its container. | |
| 75 | |
| 76 @group Polymer Core Elements | |
| 77 @element core-dropdown | |
| 78 @extends core-overlay | |
| 79 @homepage github.io | |
| 80 --><html><head><link href="../polymer/polymer.html" rel="import"> | |
| 81 <link href="../core-overlay/core-overlay.html" rel="import"> | |
| 82 | |
| 83 <style shim-shadowdom=""> | |
| 84 html /deep/ core-dropdown { | |
| 85 position: absolute; | |
| 86 overflow: auto; | |
| 87 background-color: #fff; | |
| 88 } | |
| 89 </style> | |
| 90 | |
| 91 </head><body><polymer-element name="core-dropdown" extends="core-overlay" assetp
ath=""> | |
| 92 | |
| 93 </polymer-element> | |
| 94 <script charset="utf-8" src="core-dropdown-extracted.js"></script></body></html> | |
| OLD | NEW |