forked from HemantNegi/jquery.sumoselect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
select_responsive.html
231 lines (213 loc) · 9.54 KB
/
select_responsive.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="jquery.sumoselect.min.js"></script>
<link href="sumoselect.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function () {
// add outerWidth/Height support to Zepto.js
['width', 'height'].forEach(function(dimension) {
var offset, Dimension = dimension.replace(/./, function(m) { return m[0].toUpperCase() });
$.fn['outer' + Dimension] = function(margin) {
var elem = this;
if (elem) {
var size = elem[dimension]();
var sides = {'width': ['left', 'right'], 'height': ['top', 'bottom']};
sides[dimension].forEach(function(side) {
if (margin) size += parseInt(elem.css('margin-' + side), 10);
});
return size;
} else {
return null;
}
};
});
// Examples:
window.asd = $('.SlectBox').SumoSelect({ csvDispCount: 3 });
window.test = $('.testsel').SumoSelect({okCancelInMulti:true });
});
</script>
</head>
<body>
<h1>Simple</h1>
<select name="somename" class="SlectBox" onclick="console.log($(this).val())" onchange="console.log('change is firing')">
<option disabled="disabled" selected="selected">disabled selected</option>
<!--placeholder-->
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<select class="SlectBox">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<select class="SlectBox" placeholder="this is placeholder">
<option selected="selected">selected</option>
<option>Volvo</option>
<option>Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
This is a inline select element
<select class="SlectBox" placeholder="this is placeholder">
<option selected="selected">selected</option>
<option>Volvo</option>
<option>Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
<option>Volvo</option>
<option>Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
<option>Volvo</option>
<option>Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
<option>Volvo</option>
<option>Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<h1>Multiple</h1>
<form method="get">
This is a inline select element
<select multiple="multiple" placeholder="Hello im from placeholder" class="SlectBox">
<option selected value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option disabled="disabled" value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
<option value="bmw">BMW</option>
</select>
<div class="SumoSelect">
<p class="CaptionCont SlectBoxa"><span>disabled selected</span><label><i></i></label></p>
<div class="optWrapper multiple">
<ul class="options">
<li><span><i></i></span>
<label>Volvo</label></li>
<li><span><i></i></span>
<label>saab</label></li>
<li><span><i></i></span>
<label>audi</label></li>
<li><span><i></i></span>
<label>bmw</label></li>
<li><span><i></i></span>
<label>porsche</label></li>
<li><span><i></i></span>
<label>ferrari</label></li>
<li class="selected"><span><i></i></span>
<label>hyundai</label></li>
<li><span><i></i></span>
<label>porsche</label></li>
<li><span><i></i></span>
<label>ferrari</label></li>
<li><span><i></i></span>
<label>hyundai is a good company but not too go0d !!!</label></li>
<li><span><i></i></span>
<label>porsche</label></li>
<li><span><i></i></span>
<label>ferrari</label></li>
<li><span><i></i></span>
<label>hyundai</label></li>
</ul>
</div>
</div>
<input type="submit" value="submit" />
<br />
<br />
<br />
<select multiple="multiple" placeholder="Hello im from placeholder" onchange="console.log($(this).children(':selected').length)" class="testsel">
<option selected value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option disabled="disabled" value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
<option value="bmw">BMW</option>
<option value="porsche">Porche</option>
<option value="ferrari">Ferrari</option>
<option value="audi">Audi</option>
<option value="bmw">BMW</option>
<option value="porsche">Porche</option>
<option value="ferrari">Ferrari</option>
<option value="audi">Audi</option>
<option value="bmw">BMW</option>
<option value="porsche">Porche</option>
<option value="ferrari">Ferrari</option>
<option value="hyundai">Hyundai</option>
<option value="mitsubishi">Mitsubishi</option>
</select>
</form>
<br />
<br />
<br /> <br />
<br />
<br /> <br />
<br />
<br /> <br />
<br />
<br /> <br />
<br />
<br /> <br />
<br />
<br /> <br />
<br />
<br /> <br />
<br />
<select multiple="multiple" name="somename10" class="testselect10">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option disabled="disabled" value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
<option value="bmw">BMW</option>
<option disabled="disabled" value="porsche">Porche</option>
<option selected="selected" value="ferrari">Ferrari</option>
<option selected="selected" value="hyundai">Hyundai</option>
<option value="mitsubishi">Mitsubishi</option>
</select>
<table class="auto-style5">
<tr>
<td class="auto-style6">
<ul><li>
<input id="Button1" type="button" value="Attach SumoSelect" onclick="$('.testselect10').SumoSelect();" />
</li>
<li>
<input id="Button2" type="button" value="Detach SumoSelect" onclick="$('.testselect10')[0].sumo.unload();" />
</li>
<li>
<input id="Button3" type="button" value="Add item at index 1" onclick="$('.testselect10')[0].sumo.add('New Item',1);" />
</li>
<li>
<input id="Button4" type="button" value="Remove item at index 1" onclick="$('.testselect10')[0].sumo.remove(1);" />
</li>
<li>
<input id="Button5" type="button" value="Select item at index 1" onclick="$('.testselect10')[0].sumo.selectItem(1);" />
</li>
<li>
<input id="Button6" type="button" value="UnSelect item at index 1" onclick="$('.testselect10')[0].sumo.unSelectItem(1);" />
</li>
<li>
<input id="Button7" type="button" value="Disable item at index 1" onclick="$('.testselect10')[0].sumo.disableItem(1);" />
</li>
<li>
<input id="Button8" type="button" value="Enable item at index 1" onclick="$('.testselect10')[0].sumo.enableItem(1);" />
</li>
<li>
<input id="Button9" type="button" value="Toggle Enable disable" onclick="$('.testselect10')[0].sumo.disabled = !$('.testselect10')[0].sumo.disabled" />
</li>
</ul>
</td>
<td>
</td>
</tr>
</table>
</body>
</html>