-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs.js
More file actions
44 lines (34 loc) · 1.05 KB
/
Copy pathjs.js
File metadata and controls
44 lines (34 loc) · 1.05 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
$(document).ready(function () {
let filterSlick = $('#filter');
filterSlick.slick({
infinite: false,
slidesToShow: 3,
slidesToScroll: 3
});
$('input[name="dia"]').change(function() {
let d = $(this).val();
let c = $('#op-categoria').val();
filtra( d, c );
});
$('#op-categoria').change(function() {
let d = $('input[name="dia"]:checked').val();
let c = $(this).val();
filtra( d, c );
});
function filtra( d, c ) {
filterSlick.slick('slickUnfilter');
filterSlick.slick( 'slickFilter', function() {
let retorno;
if ( d === 'all' && c !== 'all' ) {
retorno = ( $('input[name="dia"]').val() === d ) && $(this).hasClass( c );
} else if ( d !== 'all' && c === 'all' ) {
retorno = ( $(this).data('dia') === parseInt( d ) ) && $('#op-categoria').val() === c;
} else if ( d !== 'all' && c !== 'all' ) {
retorno = ( $(this).data('dia') === parseInt( d ) ) && $(this).hasClass( c );
} else {
retorno = true;
}
return retorno;
} );
}
});