OLD | NEW |
| (Empty) |
1 <!-- | |
2 @license | |
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://polym
er.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/CO
NTRIBUTORS.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/P
ATENTS.txt | |
9 --> | |
10 <!DOCTYPE html> | |
11 <html> | |
12 <head> | |
13 <title>core-overlay</title> | |
14 <meta name="viewport" content="width=device-width, user-scalable=no"> | |
15 <script src="../platform/platform.js"></script> | |
16 <link rel="import" href="../core-transition/core-transition-css.html"> | |
17 <link rel="import" href="core-overlay.html"> | |
18 <style> | |
19 body { | |
20 margin: 0; | |
21 } | |
22 | |
23 section { | |
24 padding: 24px; | |
25 } | |
26 </style> | |
27 </head> | |
28 <body unresolved> | |
29 <section> | |
30 <x-container></x-container> | |
31 </section> | |
32 | |
33 <!-- a simple dialog element made with core-overlay --> | |
34 <polymer-element name="x-dialog" attributes="opened autoCloseDisabled"> | |
35 <template> | |
36 <style> | |
37 | |
38 :host { | |
39 box-sizing: border-box; | |
40 -moz-box-sizing: border-box; | |
41 font-family: Arial, Helvetica, sans-serif; | |
42 font-size: 13px; | |
43 -webkit-user-select: none; | |
44 -moz-user-select: none; | |
45 overflow: hidden; | |
46 background: white; | |
47 padding:30px 42px; | |
48 outline: 1px solid rgba(0,0,0,0.2); | |
49 box-shadow: 0 4px 16px rgba(0,0,0,0.2); | |
50 } | |
51 </style> | |
52 <core-overlay id="overlay" layered backdrop opened="{{opened}}"
autoCloseDisabled="{{autoCloseDisabled}}" transition="core-transition-center"><
/core-overlay> | |
53 <content></content> | |
54 </template> | |
55 <script> | |
56 | |
57 Polymer('x-dialog', { | |
58 | |
59 ready: function() { | |
60 this.$.overlay.target = this; | |
61 }, | |
62 | |
63 toggle: function() { | |
64 this.$.overlay.toggle(); | |
65 } | |
66 | |
67 }); | |
68 | |
69 </script> | |
70 </polymer-element> | |
71 | |
72 | |
73 <!-- an element that uses the x-dialog element and core-overlay --> | |
74 <polymer-element name="x-container"> | |
75 <template> | |
76 <x-dialog id="dialog" class="dialog"> | |
77 <!-- place all overlay styles inside the overlay target
--> | |
78 <style no-shim> | |
79 .dialog { | |
80 box-sizing: border-box; | |
81 -moz-box-sizing: border-box; | |
82 font-family: Arial, Helvetica, sans-seri
f; | |
83 font-size: 13px; | |
84 -webkit-user-select: none; | |
85 -moz-user-select: none; | |
86 overflow: hidden; | |
87 background: white; | |
88 padding:30px 42px; | |
89 outline: 1px solid rgba(0,0,0,0.2); | |
90 box-shadow: 0 4px 16px rgba(0,0,0,0.2); | |
91 } | |
92 | |
93 #dialog { | |
94 width: 500px; | |
95 } | |
96 </style> | |
97 <h2>Dialog</h2> | |
98 <div>Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Sed fringilla sapien sed enim sollicitudin laoreet. Suspendisse suscipit,
metus ac volutpat sodales, libero magna semper lacus, molestie fringilla massa o
rci ut arcu. Nullam sodales urna sit amet odio vehicula mattis.</div><br><br> | |
99 <div>Ut aliquam vulputate congue. Vestibulum pretium pre
tium nulla quis sollicitudin. Praesent lacinia congue erat nec mattis. Fusce com
modo lacus est. Duis turpis eros, ultrices sed aliquet non, blandit egestas veli
t. Integer a augue nec lorem tristique hendrerit. Curabitur imperdiet risus id e
nim bibendum vestibulum. Integer id magna at arcu faucibus fermentum vel a augue
. Sed fringilla venenatis dolor, in blandit magna molestie luctus. Vestibulum di
gnissim posuere ultrices. Aenean urna nisl, tincidunt vitae iaculis ut, pharetra
nec eros.</div><br><br> | |
100 | |
101 <div> | |
102 <input placeholder="say something..." autofocus
on-input="{{inputHandler}}" /><br> | |
103 I agree with this wholeheartedly. | |
104 <core-overlay layered id="confirmation" class="d
ialog" backdrop transition="core-transition-top"> | |
105 <!-- place all overlay styles inside the
overlay target --> | |
106 <style no-shim> | |
107 .dialog { | |
108 box-sizing: border-box; | |
109 -moz-box-sizing: border-
box; | |
110 font-family: Arial, Helv
etica, sans-serif; | |
111 font-size: 13px; | |
112 -webkit-user-select: non
e; | |
113 -moz-user-select: none; | |
114 overflow: hidden; | |
115 background: white; | |
116 padding:30px 42px; | |
117 outline: 1px solid rgba(
0,0,0,0.2); | |
118 box-shadow: 0 4px 16px r
gba(0,0,0,0.2); | |
119 } | |
120 | |
121 #confirmation { | |
122 box-sizing: border-box; | |
123 text-align: center; | |
124 width: 150px; | |
125 } | |
126 </style> | |
127 Thank you. | |
128 </core-overlay> | |
129 </div><br><br> | |
130 <button core-overlay-toggle>OK</button> | |
131 </x-dialog> | |
132 | |
133 <button on-tap="{{tapHandler}}">Toggle Dialog</button> | |
134 </template> | |
135 <script> | |
136 | |
137 Polymer('x-container', { | |
138 | |
139 inputHandler: function(e) { | |
140 if (e.target.value === 'something') { | |
141 this.$.confirmation.toggle(); | |
142 } | |
143 }, | |
144 | |
145 tapHandler: function() { | |
146 this.$.dialog.toggle(); | |
147 } | |
148 | |
149 }); | |
150 | |
151 </script> | |
152 </polymer-element> | |
153 | |
154 </body> | |
155 </html> | |
OLD | NEW |