forked from olton/metroui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialog.html
More file actions
337 lines (320 loc) · 15.3 KB
/
Copy pathdialog.html
File metadata and controls
337 lines (320 loc) · 15.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="product" content="Metro UI CSS Framework">
<meta name="description" content="Simple responsive css framework">
<meta name="author" content="Sergey S. Pimenov, Ukraine, Kiev">
<link href="css/metro-bootstrap.css" rel="stylesheet">
<link href="css/metro-bootstrap-responsive.css" rel="stylesheet">
<link href="css/docs.css" rel="stylesheet">
<link href="js/prettify/prettify.css" rel="stylesheet">
<!-- Load JavaScript Libraries -->
<script src="js/jquery/jquery.min.js"></script>
<script src="js/jquery/jquery.widget.min.js"></script>
<script src="js/jquery/jquery.mousewheel.js"></script>
<script src="js/prettify/prettify.js"></script>
<!-- Metro UI CSS JavaScript plugins -->
<script src="js/load-metro.js"></script>
<!-- Local JavaScript -->
<script src="js/docs.js"></script>
<script src="js/github.info.js"></script>
<title>Metro UI CSS : Metro Bootstrap CSS Library</title>
</head>
<body class="metro">
<header class="bg-dark" data-load="header.html"></header>
<div class="container">
<h1>
<a href="/"><i class="icon-arrow-left-3 fg-darker smaller"></i></a>
Dialog<small class="on-right">plugin</small>
</h1>
<p class="description">
You can create a dialog box at any time via the Dialog plugin
</p>
<div class="example">
<button class="button" id="createWindow">Create Window</button>
<button class="button" id="createFlatWindow">Create Flat Window</button>
<button class="button" id="createWindowYoutube">Youtube Video</button>
<button class="button" id="createWindowDraggable">Create Draggable Window</button>
<button class="button" id="createSysEventsWindow">SysBtn Events</button>
</div>
<script>
$(function(){
$("#createSysEventsWindow").on('click', function(){
$.Dialog({
shadow: true,
overlay: false,
icon: '',
title: 'Title',
width: 500,
padding: 10,
content: 'Window content here',
draggable: true,
sysButtons: {
btnMin: true,
btnMax: true,
btnClose: true
},
sysBtnCloseClick: function(e){
alert('Close button click');
},
sysBtnMinClick: function(e){
alert('Min button click');
},
sysBtnMaxClick: function(e){
alert('Max button click');
}
});
});
$("#createWindow").on('click', function(){
$.Dialog({
shadow: true,
overlay: false,
icon: '<span class="icon-rocket"></span>',
title: 'Title',
width: 500,
padding: 10,
content: 'Window content here'
});
});
$("#createWindowDraggable").on('click', function(){
$.Dialog({
shadow: true,
overlay: false,
draggable: true,
icon: '<span class="icon-bus"></span>',
title: 'Draggable window',
width: 500,
padding: 10,
content: 'This Window is draggable by caption.',
onShow: function(){
var content = '<form id="login-form-1">' +
'<label>Login</label>' +
'<div class="input-control text"><input type="text" name="login"><button class="btn-clear"></button></div>' +
'<label>Password</label>'+
'<div class="input-control password"><input type="password" name="password"><button class="btn-reveal"></button></div>' +
'<div class="input-control checkbox"><label><input type="checkbox" name="c1" checked/><span class="check"></span>Check me out</label></div>'+
'<div class="form-actions">' +
'<button class="button primary">Login to...</button> '+
'<button class="button" type="button" onclick="$.Dialog.close()">Cancel</button> '+
'</div>'+
'</form>';
$.Dialog.title("User login");
$.Dialog.content(content);
}
});
});
$("#createFlatWindow").on('click', function(){
$.Dialog({
overlay: true,
shadow: true,
flat: true,
draggable: true,
icon: '<img src="images/excel2013icon.png">',
title: 'Flat window',
content: '',
padding: 10,
onShow: function(_dialog){
var content = '<form class="user-input">' +
'<label>Login</label>' +
'<div class="input-control text"><input type="text" name="login"><button class="btn-clear"></button></div>' +
'<label>Password</label>'+
'<div class="input-control password"><input type="password" name="password"><button class="btn-reveal"></button></div>' +
'<div class="input-control checkbox"><label><input type="checkbox" name="c1" checked/><span class="check"></span>Check me out</label></div>'+
'<div class="form-actions">' +
'<button class="button primary">Login to...</button> '+
'<button class="button" type="button" onclick="$.Dialog.close()">Cancel</button> '+
'</div>'+
'</form>';
$.Dialog.title("User login");
$.Dialog.content(content);
}
});
});
$("#createWindowYoutube").on('click', function(){
$.Dialog({
overlay: false,
shadow: true,
flat: false,
icon: '<img src="images/excel2013icon.png">',
title: 'Window 8.1 Everywhere For Everything!',
content: '',
onShow: function(_dialog){
var html = [
'<iframe width="640" height="480" src="//www.youtube.com/embed/_24bgSxAD9Q" frameborder="0" allowfullscreen></iframe>'
].join("");
$.Dialog.content(html);
}
});
});
})
</script>
<pre class="prettyprint linenums">
$("#createWindow").on('click', function(){
$.Dialog({
shadow: true,
overlay: false,
icon: '<span class="icon-rocket"></span>',
title: 'Title',
width: 500,
padding: 10,
content: 'Window content here'
});
});
$("#createFlatWindow").on('click', function(){
$.Dialog({
overlay: true,
shadow: true,
flat: true,
icon: '<img src="images/excel2013icon.png">',
title: 'Flat window',
content: '',
onShow: function(_dialog){
var content = _dialog.children('.content');
content.html('Set content from event onShow');
}
});
});
$("#createWindowYoutube").on('click', function(){
$.Dialog({
overlay: false,
shadow: true,
flat: false,
icon: '<img src="images/excel2013icon.png">',
title: 'Window 8.1 Everywhere For Everything!',
content: '',
onShow: function(_dialog){
var html = [
'<iframe width="640" height="480"
src="//www.youtube.com/embed/_24bgSxAD9Q"
frameborder="0"></iframe>'
].join("");
$.Dialog.content(html);
}
});
});
</pre>
<h3>Parameters:</h3>
<div>
<table class="table striped border">
<tr>
<td>icon</td>
<td>false</td>
<td>false or html tag (span with class <code>icon-*</code> or <code>img</code>)</td>
</tr>
<tr>
<td>title</td>
<td>string</td>
<td>string (plain text or html) for dialog title</td>
</tr>
<tr>
<td>content</td>
<td>string</td>
<td>string (plain text or html) for dialog content</td>
</tr>
<tr>
<td>flat</td>
<td>boolean</td>
<td>default false, create flat style dialog</td>
</tr>
<tr>
<td>shadow</td>
<td>boolean</td>
<td>default false, create shadow for dialog</td>
</tr>
<tr>
<td>overlay</td>
<td>boolean</td>
<td>default false, show overlay for dialog</td>
</tr>
<tr>
<td>draggable</td>
<td>boolean</td>
<td>default false, set dialog draggable</td>
</tr>
<tr>
<td>width</td>
<td>int or string (percent)</td>
<td>default 'auto', if value != auto min-width sets</td>
</tr>
<tr>
<td>height</td>
<td>int or string (percent)</td>
<td>default 'auto', if value != auto min-height sets</td>
</tr>
<tr>
<td>padding</td>
<td>int</td>
<td>default 0, set content padding</td>
</tr>
<tr>
<td>position</td>
<td>'default' or object {offsetX, offsetY}</td>
<td>default 'default', dialog position</td>
</tr>
<tr>
<td>sysButtons</td>
<td>false or object {btnClose, btnMax, btnMin}</td>
<td>default {btnClose: true}, dialog system buttons</td>
</tr>
</table>
</div>
<h3>Events</h3>
<p class="description">Dialog plugin now support event <code>onShow</code>. You can set content for dialog from the event, after dialog is showing.</p>
<pre class="prettyprint linenums">
$("#createWindow").on('click', function(){
$.Dialog({
shadow: true,
overlay: true,
icon: '<span class="icon-rocket"></span>',
title: 'Title',
content: 'Window content here',
onShow: function(_dialog){
console.log(_dialog);
}
});
});
</pre>
<h4>Any components in dialog</h4>
<p>
If you a used any Metro UI CSS components in dialog and this components required init from javascript you must re init components with <code>$.Metro.init*</code> functions.
</p>
<pre class="prettyprint linenums">
$("#createFlatWindow").on('click', function(){
$.Dialog({
overlay: true,
shadow: true,
flat: true,
icon: '<img src="images/excel2013icon.png">',
title: 'Flat window',
content: '',
padding: 10,
onShow: function(_dialog){
var content = '<form>' +
'<label>Login</label>' +
'<div class="input-control text"><input type="text" name="login">
<button class="btn-clear"></button></div> ' +
'<label>Password</label>' +
'<div class="input-control password">
<input type="password" name="password">
<button class="btn-reveal"></button></div> ' +
'<div class="input-control checkbox">
<label><input type="checkbox" name="c1" checked/>
<span class="check"></span>Check me out</label></div>'+
'<div class="form-actions">' +
'<button class="button primary">Login to...</button> '+
'<button class="button" type="button" onclick="$.Dialog.close()">Cancel</button> '+
'</div>'+
'</form>';
$.Dialog.title("User login");
$.Dialog.content(content);
$.Metro.initInputs();
}
});
});
</pre>
</div>
<script src="js/hitua.js"></script>
</body>
</html>