-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
182 lines (163 loc) · 7.93 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author" content="Nirbhay Pherwani">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Filter Elements Plugin Sample Usage</title>
</head>
<body>
<div class="container jumbotron">
<h1>jQuery Filter Elements Plugin</h1>
<h2>Hi there!</h2>
<h5>Here you will find some sample usages of the plugin.</h5>
<h5>GitHub Repository - <a href="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/nirbhayph/jQuery-Search-Filter-Plugin" target="_blank">jQuery Filter Elements Plugin</a></h5>
<h5>@Author - Nirbhay Pherwani - <a href="https://nirbhay.me" target="_blank">https://nirbhay.me</a></h5>
</div>
<!-- Example 1 Code -->
<div class="container">
<h4>Example 1 - With Simple List Group [Case Insensitive]</h4>
<!-- Text Input -->
<div class="active-cyan-3 active-cyan-4 mb-4">
<input id="list-search" class="form-control" type="text" placeholder="Try Searching ..." aria-label="Search">
</div>
<!-- Text Input Ends -->
<ul class="list-group" id="my-list-items">
<li class="list-group-item">This is a list group item</li>
<li class="list-group-item list-group-item-primary">This is a primary list group item</li>
<li class="list-group-item list-group-item-secondary">This is a secondary list group item</li>
<li class="list-group-item list-group-item-success">This is a success list group item</li>
<li class="list-group-item list-group-item-danger">This is a danger list group item</li>
<li class="list-group-item list-group-item-warning">This is a warning list group item</li>
<li class="list-group-item list-group-item-info">This is a info list group item</li>
<li class="list-group-item list-group-item-light">This is a light list group item</li>
<li class="list-group-item list-group-item-dark">This is a dark list group item</li>
</ul>
</div>
<!-- Example 1 Code Ends -->
<br/> <br/>
<!-- Example 2 Code -->
<div class="container">
<h4>Example 2 - With Simple List Group [Case Sensitive]</h4>
<!-- Text Input -->
<div class="active-cyan-3 active-cyan-4 mb-4">
<input id="list-search-2" class="form-control" type="text" placeholder="Try Searching ..." aria-label="Search">
</div>
<!-- Text Input Ends -->
<ul class="list-group" id="my-list-items-2">
<li class="list-group-item">This is a list group item</li>
<li class="list-group-item list-group-item-primary">This is a primary list group item</li>
<li class="list-group-item list-group-item-secondary">This is a secondary list group item</li>
<li class="list-group-item list-group-item-primary">This is a primary list group item</li>
<li class="list-group-item list-group-item-secondary">This is a secondary list group item</li>
<li class="list-group-item list-group-item-primary">This is a primary list group item</li>
<li class="list-group-item list-group-item-secondary">This is a secondary list group item</li>
<li class="list-group-item list-group-item-primary">This is a primary list group item</li>
<li class="list-group-item list-group-item-secondary">This is a secondary list group item</li>
</ul>
</div>
<!-- Example 2 Code Ends -->
<br/><br/>
<!-- Example 3 Code -->
<div class="container">
<h4>Example 3 - With Table [Marking Filtered and UnFiltered Items]</h4>
<!-- Text Input -->
<div class="active-cyan-3 active-cyan-4 mb-4">
<input id="list-search-3" class="form-control" type="text" placeholder="Try Searching ..." aria-label="Search">
</div>
<!-- Text Input Ends -->
<table class="table my-table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
<tr>
<th scope="row">4</th>
<td>Nirbhay</td>
<td>the Eagle</td>
<td>@instagram</td>
</tr>
<tr>
<th scope="row">5</th>
<td>Mora</td>
<td>the Ant</td>
<td>@github</td>
</tr>
</tbody>
</table>
</div>
<!-- Example 3 Code Ends -->
<footer class="container">
<h5>
<p>
There are other option like 'controlNext' which controls the display of the sibling child element.
Also the text and background colors can be changed for the child elements if marking is enabled.
You can use it to filter other elements like accordions or any other kind of list items too.
Have fun using the plugin!
</p>
<p>
@Author - Nirbhay Pherwani - <a href="https://nirbhay.me" target="_blank">https://nirbhay.me</a>
</p>
</h5>
</footer>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- Our jQuery Plugin Import -->
<script src="filter_elements_plugin.js"></script>
<!-- Example 1 Plugin Usage (Case Insesitive)-->
<script>
$("#list-search").filterElements({
parentElementWrapper: "#my-list-items",
childElementToFilter: '.list-group-item',
caseInsensitive: true
});
</script>
<!-- Example 1 Plugin Usage Ends -->
<!-- Example 2 Plugin Usage (Case Sensitive)-->
<script>
$("#list-search-2").filterElements({
parentElementWrapper: "#my-list-items-2",
childElementToFilter: '.list-group-item'
});
</script>
<!-- Example 2 Plugin Usage Ends -->
<!-- Example 3 Plugin Usage (Displays both filtered and non filtered) -->
<script>
$("#list-search-3").filterElements({
parentElementWrapper: ".my-table",
childElementToFilter: 'tr',
markFiltered: true,
markNonFiltered: true,
caseInsensitive: true
});
</script>
<!-- Example 3 Plugin Usage Ends -->
</body>
</html>