-
Notifications
You must be signed in to change notification settings - Fork 12
/
demo.js
102 lines (67 loc) · 1.89 KB
/
demo.js
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
$(function() {
$('#ex1f').instaFilta({
scope: '#ex1'
});
$('#ex2f').instaFilta({
scope: '#ex2'
});
$('#ex3f').instaFilta({
scope: '#ex3',
targets: '.planet-name',
caseSensitive: true
});
$('#ex4f').instaFilta({
scope: '#ex4',
markMatches: true
});
$('#ex5f').instaFilta({
scope: '#ex5',
beginsWith: true
});
$('#ex6f').instaFilta({
scope: '#ex6',
beginsWith: true
});
var $resultMessage = $('#some-result-message');
$('#ex7f').instaFilta({
scope: '#ex7',
onFilterComplete: function(matchedItems) {
var message = matchedItems.length
? "I found " + matchedItems.length + " matches!"
: "I couldn't find a thing..";
$resultMessage.text(message);
}
});
var ex8 = $('#ex8f').instaFilta({
scope: '#ex8'
});
$('#ex8s').on('change', function() {
ex8.filterCategory($(this).val());
});
var ex9 = $('#ex9f').instaFilta({
scope: '#ex9'
});
var $ex9Checkboxes = $('#ex9 [type=checkbox]');
$ex9Checkboxes.on('change', function() {
var checkedCategories = [];
$ex9Checkboxes.each(function() {
if ($(this).prop('checked')) {
checkedCategories.push($(this).val());
}
});
ex9.filterCategory(checkedCategories);
});
var ex10 = $('#ex10f').instaFilta({
scope: '#ex10'
});
var $ex10Checkboxes = $('#ex10 [type=checkbox]');
$ex10Checkboxes.on('change', function() {
var checkedCategories = [];
$ex10Checkboxes.each(function() {
if ($(this).prop('checked')) {
checkedCategories.push($(this).val());
}
});
ex10.filterCategory(checkedCategories, true);
});
});