forked from jschr/bootstrap-modal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
321 lines (294 loc) · 11.4 KB
/
index.html
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Bootstrap-modal by jschr</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
<link href="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css" rel="stylesheet" />
<style>
body {
padding-top: 40px;
}
/* .navbar-fixed-top {
margin-right: 18px;
}
@media (max-width: 979px){
.navbar-fixed-top {
margin-right: 0px;
}*/
}
</style>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="css/bootstrap-modal.css" rel="stylesheet"></link>
<style>
.text-center {
text-align: center;
}
</style>
</head>
<body>
<div class="page-container">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="./index.html">Bootstrap - Modal</a>
<div class="pull-right">
<iframe style="margin-top: 10px" src="http://ghbtns.com/github-btn.html?user=jschr&repo=bootstrap-modal&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="80px" height="20px"></iframe>
<iframe style="margin-top: 10px" src="http://ghbtns.com/github-btn.html?user=jschr&repo=bootstrap-modal&type=fork&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="80px" height="20px"></iframe>
</div>
</div>
</div>
</div>
<div class="container" style="position: relative">
<div class="row-fluid">
<div class="span12">
<div class="responsive">
<h3>Responsive</h3>
<pre class="pre-scrollable prettyprint linenums" data-source="#responsive">
</pre>
<div class="text-center">
<button class="demo btn btn-primary btn-large" data-toggle="modal" href="#responsive">View Demo</button>
</div>
</div>
<div class="stackable">
<h3>Stackable</h3>
<pre class="pre-scrollable prettyprint linenums" data-source="#stack1, #stack2, #stack3">
</pre>
<div class="text-center">
<button class="demo btn btn-primary btn-large" data-toggle="modal" href="#stack1">View Demo</button>
</div>
</div>
<!--<div class="dynamic">
<h3>Dynamic</h3>
<pre class="pre-scrollable prettyprint linenums" data-source="#dynamic">
</pre>
<div class="text-center">
<button class="demo btn btn-primary btn-large" data-toggle="modal">View Demo</button>
</div>
</div>-->
<div class="ajax" style="position: relative; overflow: hidden">
<h3>AJAX (via jQuery.load)</h3>
<pre class="pre-scrollable prettyprint linenums" data-source="#ajax">
</pre>
<div class="text-center">
<button class="demo btn btn-primary btn-large" data-toggle="modal">View Demo</button>
</div>
</div>
<div class="full-width" style="position: relative; overflow: hidden">
<h3>Full Width</h3>
<pre class="pre-scrollable prettyprint linenums" data-source="#full-width">
</pre>
<div class="text-center">
<button class="demo btn btn-primary btn-large" data-toggle="modal" href="#full-width">View Demo</button>
</div>
</div>
<div class="custom-manager" style="position: relative; overflow: hidden">
<h3>Custom Manager</h3>
<pre class="pre-scrollable prettyprint linenums" data-source="#custom-manager">
</pre>
<div class="text-center">
<button class="demo btn btn-primary btn-large" data-toggle="modal">View Demo</button>
</div>
</div>
</div>
</div>
</div>
<br />
<br />
</div>
<div class="modal-container"></div>
<!-- Modal Definitions (tabbed over for <pre>) -->
<div id="responsive" class="modal hide fade" tabindex="-1" data-width="760">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<div class="row-fluid">
<div class="span6">
<h4>Some Input</h4>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
</div>
<div class="span6">
<h4>Some More Input</h4>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
<p><input type="text" class="span12" /></p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
<div id="full-width" class="modal container hide fade" tabindex="-1">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>This modal will resize itself to the same dimensions as the container class.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sollicitudin ipsum ac ante fermentum suscipit. In ac augue non purus accumsan lobortis id sed nibh. Nunc egestas hendrerit ipsum, et porttitor augue volutpat non. Aliquam erat volutpat. Vestibulum scelerisque lobortis pulvinar. Aenean hendrerit risus neque, eget tincidunt leo. Vestibulum est tortor, commodo nec cursus nec, vestibulum vel nibh. Morbi elit magna, ornare placerat euismod semper, dignissim vel odio. Phasellus elementum quam eu ipsum euismod pretium.</p>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
<div id="stack1" class="modal hide fade" tabindex="-1">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
<p>One fine body…</p>
<p>One fine body…</p>
<button class="btn" data-toggle="modal" href="#stack2">Launch modal</button>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn">Close</button>
<button type="button" class="btn btn-primary">Ok</button>
</div>
</div>
<div id="stack2" class="modal hide fade" tabindex="-1">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
<p>One fine body…</p>
<button class="btn" data-toggle="modal" href="#stack3">Launch modal</button>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn">Close</button>
<button type="button" class="btn btn-primary">Ok</button>
</div>
</div>
<div id="stack3" class="modal hide fade" tabindex="-1">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn">Close</button>
<button type="button" class="btn btn-primary">Ok</button>
</div>
</div>
<div id="myModal" class="modal hide fade" tabindex="-1">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>This modal is in a custom manager</p>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn">Close</button>
<button type="button" class="btn btn-primary">Ok</button>
</div>
</div>
<div id="ajax-modal" class="modal hide fade" tabindex="-1"></div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js"></script>
<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap.js"></script>
<script src="js/bootstrap-modalmanager.js"></script>
<script src="js/bootstrap-modal.js"></script>
<script type="text/javascript">
//$.fn.modal.defaults.spinner = '<img class="loading-spinner" src="img/ajax-loader.gif" />';
//$.fn.modalmanager.defaults.spinner = '<img class="loading-spinner" src="img/ajax-loader.gif" />';
$(function(){
$('[data-source]').each(function(){
var $this = $(this),
$source = $($this.data('source'));
var text = [];
$source.each(function(){
var $s = $(this);
if ($s.attr('type') == 'text/javascript'){
text.push($s.html().replace(/(\n)*/, ''));
} else {
text.push($s.clone().wrap('<div>').parent().html());
}
});
$this.text(text.join('\n\n').replace(/\t/g, ' '));
});
prettyPrint();
});
</script>
<script id="dynamic" type="text/javascript">
$('.dynamic .demo').click(function(){
var tmpl = [
// tabindex is required for focus
'<div class="modal hide fade" tabindex="-1">',
'<div class="modal-header">',
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>',
'<h3>Modal header</h3>',
'</div>',
'<div class="modal-body">',
'<p>Test</p>',
'</div>',
'<div class="modal-footer">',
'<a href="#" data-dismiss="modal" class="btn">Close</a>',
'<a href="#" class="btn btn-primary">Save changes</a>',
'</div>',
'</div>'
].join('');
$(tmpl).modal();
});
</script>
<script id="custom-manager" type="text/javascript">
// provide the container for all assigned modals to the manager
var myManager = new ModalManager($('.custom-manager'));
$('.custom-manager .demo').on('click', function(){
// helper function for modal creation
myManager.createModal($('#myModal'));
/* Alternatively:
$('#myModal').modal({ manager: myManager });
*/
});
</script>
<script id="ajax" type="text/javascript">
// NOTE: modal must be in the DOM before calling .load()
var $modal = $('#ajax-modal');
$('.ajax .demo').on('click', function(){
// create the backdrop and wait for next modal to be triggered
GlobalModalManager.loading();
setTimeout(function(){
$modal.load('modal_ajax_test.html', '', function(){
$modal.modal();
});
}, 1000);
});
$modal.on('click', '.update', function(){
$modal.modal('loading');
setTimeout(function(){
$modal
.modal('loading')
.find('.modal-body')
.prepend('<div class="alert alert-info fade in">' +
'Updated!<button type="button" class="close" data-dismiss="alert">×</button>' +
'</div>');
}, 1000);
});
</script>
</body>
</html>