forked from zewish/rmodal.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
111 lines (95 loc) · 3.94 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta charset="UTF-8" />
<title>rmodal.js</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<link rel="stylesheet" href="http://raw.github.com/daneden/animate.css/master/animate.css" type="text/css" />
<link rel="stylesheet" href="dist/rmodal.css" type="text/css" />
<script type="text/javascript" src="dist/rmodal.js"></script>
<script type="text/javascript">
window.onload = function() {
var modal = new RModal(document.getElementById('modal'), {
beforeOpen: function(next) {
console.log('beforeOpen');
next();
}
, afterOpen: function() {
console.log('opened');
}
, beforeClose: function(next) {
console.log('beforeClose');
next();
}
, afterClose: function() {
console.log('closed');
}
// , content: 'Abracadabra'
// , bodyClass: 'modal-open'
// , dialogClass: 'modal-dialog-lg'
// , dialogOpenClass: 'fadeIn'
// , dialogCloseClass: 'fadeOut'
// , focus: true
// , focusElements: ['input.form-control', 'textarea', 'button.btn-primary']
// , escapeClose: true
});
document.addEventListener('keydown', function(ev) {
modal.keydown(ev);
}, false);
document.getElementById('showModal').addEventListener("click", function(ev) {
ev.preventDefault();
modal.open();
}, false);
window.modal = modal;
}
</script>
</head>
<body>
<div id="modal" class="modal">
<div class="modal-dialog animated">
<div class="modal-content">
<form class="form-horizontal" method="get">
<div class="modal-header">
<strong>Yep, I'm a dialog...</strong>
</div>
<div class="modal-body">
<div class="form-group">
<label for="dummyText" class="control-label col-xs-4">Dummy text</label>
<div class="input-group col-xs-7">
<input type="text" name="dummyText" id="dummyText" class="form-control" />
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="button" onclick="modal.close();">Cancel</button>
<button class="btn btn-primary" type="submit" onclick="modal.close();">Save</button>
</div>
</form>
</div>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h3>rmodal.js</h3>
<ul>
<li>A simple modal dialog</li>
<li>Plain JavaScript only - no dependencies</li>
<li>All browsers supported (IE9+)</li>
<li>Less than 1.2 KB when gzipped and minified</li>
<li>Bootstrap and Animate.css friendly</li>
<li>Fully unit tested</li>
<li>Supports CommonJS, AMD or globals</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<a href="#" id="showModal" class="btn btn-success">Show modal</a>
</div>
</div>
</div>
</body>
</html>