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