forked from balachuang/DualSelectList
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
81 lines (71 loc) · 3.08 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8">
<title>DualSelectList example</title>
<link rel="stylesheet" type="text/css" href="bala.DualSelectList/css/bala.DualSelectList.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="bala.DualSelectList/js/bala.DualSelectList.jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var dsl = $('#dualSelectExample').DualSelectList({
'candidateItems' : ['Item 01', 'Item 02', 'Item 03', 'Item 04', 'Item 05', 'Item 06', 'Item 07'],
'selectionItems' : ['Item 08', 'Item 09', 'Item 03'],
'colors' : {
'itemText' : 'white',
'itemBackground' : 'rgb(0, 51, 204)',
'itemHoverBackground' : '#0066ff'
}
});
$('#getSel').click(function(){
var res = dsl.getSelection();
var str = '';
for (var n=0; n<res.length; ++n) str += res[n] + '\n';
$('#selResult').val(str);
});
$('#addSel').click(function(){
var items = $('#addIterms').val().split('\n');
var res = dsl.setCandidate(items);
$('#addIterms').val('');
});
$('#setColor').click(function(){
var clrName = $('#colorSelector').val();
var clrValue = $('#colorValue').val();
dsl.setColor(clrName, clrValue);
});
$('#resetColor').click(function(){
var clrName = $('#colorSelector').val();
dsl.resetColor(clrName);
});
});
</script>
</head>
<body>
<div>This is the example of jQuery plugin Dual-Select-List, which provids multiple-select function through 2 List-Boxes.</div><br>
<div id="dualSelectExample" style="width:500px; height:300px; background-color:#F0F0F0; padding:10px;"></div><br>
<div style="padding-bottom:20px;">
Set Color:
<select id="colorSelector">
<option value="panelBackground">panelBackground</option>
<option value="filterText">filterText</option>
<option value="itemText">itemText</option>
<option value="itemBackground">itemBackground</option>
<option value="itemHoverBackground">itemHoverBackground</option>
<option value="itemPlaceholderBackground">itemPlaceholderBackground</option>
<option value="itemPlaceholderBorder">itemPlaceholderBorder</option>
<option value="">All Objects</option>
</select>
<input id="colorValue" value="" style="width:130px; margin-right:20px;" />
<input type="button" id="setColor" value="Set" />
<input type="button" id="resetColor" value="Reset" />
</div>
<div style="float:left; margin-right:5px;">
<div id="addSel" style="background-color:lightgray; color:black; padding:5px; text-align:center; cursor:pointer; width:150px;">Add Candidate</div>
<textarea id="addIterms" rows="5" type="textarea" style="width:250px; height:100px; margin-top:5px;"></textarea>
</div>
<div style="float:left;">
<div id="getSel" style="background-color:lightgray; color:black; padding:5px; text-align:center; cursor:pointer; width:150px;">Get Selection</div>
<textarea id="selResult" rows="5" type="textarea" style="width:250px; height:100px; margin-top:5px;"></textarea>
</div>
</body>
</html>