-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadme.html
More file actions
212 lines (190 loc) · 8.99 KB
/
Copy pathreadme.html
File metadata and controls
212 lines (190 loc) · 8.99 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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Bootstrap Dropdown for Select element - bootstrap-ddselect.js</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" />
<style>
hr {
margin: 40px 0 39px;
}
</style>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>bootstrap-ddselect.js<br />
<small>Transform HTML Select elements to Bootstrap Split Button Dropdowns</small></h1>
</div>
<div class="">
<div class="">
</div>
<div class="">
<h2>About</h2>
<p>This jQuery plugin extends the <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a> front-end framework to transform <code><select></code> elements to split button dropdowns (or dropups).</p>
<dl>
<dt>Version</dt>
<dd>1.0.1</dd>
<dt>Author</dt>
<dd>Martin Eriksson</dd>
</dl>
<hr />
<h2>Features</h2>
<ul>
<li>Supports the bootstrap default button styles.</li>
<li>Supports option groups.</li>
</ul>
<hr />
<h2>Examples</h2>
<p>A basic <code><select></code> element.</p>
<div class="well">
<select id="simple-example" name="simple">
<option value="Pizza">Pizza</option>
<option value="Hamburger">Hamburger</option>
<option value="Sandwich">Sandwich</option>
<option value="Sushi">Sushi</option>
</select>
</div>
<p>A <code><select></code> element with <code><optgroup></code> children and a single orphan <code><option></code> element.</p>
<div class="well">
<select>
<optgroup label="Fruits">
<option value="Apple">Apple</option>
<option value="Banana">Banana</option>
<option value="Orange">Orange</option>
<option value="Pear">Pear</option>
</optgroup>
<optgroup label="Vegetables">
<option value="Carrot">Carrot</option>
<option value="Cucumber">Cucumber</option>
<option value="Pumpkin">Pumpkin</option>
<option value="Tomatoe">Tomatoe</option>
</optgroup>
<option value="Beef">Beef</option>
</select>
</div>
<p>A disabled <code><select></code> element.</p>
<div class="well">
<select disabled="disabled">
<option value="Pizza">Pizza</option>
<option value="Hamburger">Hamburger</option>
<option value="Sandwich">Sandwich</option>
<option value="Sushi">Sushi</option>
</select>
</div>
<p>A <code><select></code> element with a disabled <code><option></code>.</p>
<div class="well">
<select>
<option value="Pizza">Pizza</option>
<option value="Hamburger">Hamburger</option>
<option value="Sandwich" disabled="disabled">Sandwich</option>
<option value="Sushi">Sushi</option>
</select>
</div>
<p>Example of using <code>btn-success</code> for button style.</p>
<div class="well">
<select id="button-style">
<option value="Pizza">Pizza</option>
<option value="Hamburger">Hamburger</option>
<option value="Sandwich" disabled="disabled">Sandwich</option>
<option value="Sushi">Sushi</option>
</select>
</div>
<p>Example of using <code>.btn-mini</code> bootstrap button style.</p>
<div class="well">
<select id="button-size">
<option value="Pizza">Pizza</option>
<option value="Hamburger">Hamburger</option>
<option value="Sandwich" disabled="disabled">Sandwich</option>
<option value="Sushi">Sushi</option>
</select>
</div>
<p>Example a dropup</p>
<div class="well">
<select id="dropup">
<option value="Pizza">Pizza</option>
<option value="Hamburger">Hamburger</option>
<option value="Sandwich" disabled="disabled">Sandwich</option>
<option value="Sushi">Sushi</option>
</select>
</div>
<hr />
<h2>Usage</h2>
<h3>Via JavaScript</h3>
<p>Call the dropdowns via JavaScript:</p>
<pre>$('select').ddselect();</pre>
<h3>Options</h3>
<p>Options can be passed via JavaScript.</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>parentClass</td>
<td>string</td>
<td></td>
<td>Adds a CSS class to the parent element.</td>
</tr>
<tr>
<td>buttonClass</td>
<td>string</td>
<td></td>
<td>Use any of the bootstrap button style class names to style your dropdown.
Class names are <code>.btn-primary</code>,
<code>.btn-info</code>, <code>.btn-success</code>, <code>.btn-warning</code>,
<code>.btn-danger</code> and <code>.btn-inverse</code>,
</td>
</tr>
<tr>
<td>sizeClass</td>
<td>string</td>
<td></td>
<td>Use any of the bootstrap button size class names to size your dropdown.
Class names are <code>.btn-mini</code>, <code>.btn-small</code> and <code>.btn-large</code>.
</td>
</tr>
<tr>
<td>dropup</td>
<td>bool</td>
<td>false</td>
<td>Set to <code>true</code> to transform the dropdown into a dropup.
</td>
</tr>
</tbody>
</table>
<h3>Methods</h3>
<h4>$().ddselect('refresh')</h4>
<p>Refreshes the dropdown completely. Use this if you have changed anything but the selected value of the original <code><select></code> element to update the dropdown.</p>
<h4>$().ddselect('show')</h4>
<p>Show the dropdown.</p>
<h4>$().ddselect('hide')</h4>
<p>Hide the dropdown.</p>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.js"></script>
<script src="bootstrap-ddselect.js"></script>
<script>
$('select').not('#button-style').not('#button-size').not('#dropup').ddselect();
$('select#button-style').ddselect({
buttonClass: 'btn-success'
});
$('select#button-size').ddselect({
sizeClass: 'btn-mini'
});
$('select#dropup').ddselect({
dropup: true
});
$('form').submit(function (e) {
e.preventDefault();
$('.result').text($(this).serialize());
});
</script>
</body>
</html>