-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
78 lines (69 loc) · 2.52 KB
/
example.html
File metadata and controls
78 lines (69 loc) · 2.52 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Chameleon UI – Modal</title>
<style>
.modal {
border: 1px solid red;
padding: 1em;
}
.is-hidden {
display: none;
}
#content {
border: 1px solid #999;
margin: 1em 0;
padding: 1em;
}
</style>
</head>
<body>
<h1>Chameleon UI – Modal</h1>
<p id="hook">Build a Modal object, place it as in DOM, show it and set content.</p>
<button class="modal-place">Place modal</button>
<button class="modal-show">Show modal</button>
<br />
<button class="modal-content-set">Set "In-page" content</button>
<button class="modal-content-null">Set "null" content</button>
<button class="modal-content-ajax">Set AJAX content</button>
<button class="modal-content-ajax-error5">Set AJAX Error 500</button>
<button class="modal-content-ajax-error4">Set AJAX Error 403</button>
<br />
<button class="modal-toggle">Toggle modal</button>
<button class="modal-hide">Hide modal</button>
<button class="modal-remove">Remove modal</button>
<hr />
<h3>In-page content:</h3>
<div id="content">
<strong>Hello</strong>, I am test in-page content.
</div>
<!-- ===================================== -->
<script src="build/build.js"></script>
<script>
var $ = require('jquery');
var Modal = require('modal');
var m = new Modal('#hook', { method: 'after' });
['place','remove','show','hide', 'toggle'].map(function(x){
$('body').on('click.modal-'+x, '.modal-'+x, function(e) {
m[x]();
});
});
$('body').on('click.modal-content-set', '.modal-content-set', function(e) {
m.content($('#content').html());
});
$('body').on('click.modal-content-null', '.modal-content-null', function(e) {
m.content(null);
});
$('body').on('click.modal-content-ajax', '.modal-content-ajax', function(e) {
m.ajaxContent('http://chameleonui.apiary.io/modal');
});
$('body').on('click.modal-content-ajax-error', '.modal-content-ajax-error5', function(e) {
m.ajaxContent('http://chameleonui.apiary.io/modal-error500');
});
$('body').on('click.modal-content-ajax-error', '.modal-content-ajax-error4', function(e) {
m.ajaxContent('http://chameleonui.apiary.io/modal-error403');
});
</script>
</body>
</html>