JSFiddle - React, Tailwind, and code Playground
by Brett
JavaScript
/* A-Z: Category filtering
var $results = g('.section-a-to-z .view-content .views-row');
var $checks = g('.section-a-to-z input[name^=fl]').change(function() {
var $checked = $checks.filter('.section-a-to-z :checked');
// show all when nothing checked
if(!$checked.length) {
$results.show();
return;
}
// create array of checked values
var checkedVals = g.map($checked, function(el) {
return el.value;
});
// hide all results, then filter for matches
$results.hide().filter(function() {
var cats = g(this).data('category').split(' ');
var checkMatches = g.grep(checkedVals, function(val) {
return g.inArray(val, cats) >-1;
});
return checkMatches.length === checkedVals.length;
// show results that match all checkboxes
}).show();
});*/
/* A-Z: Activate HideSeek plugin on A-Z search input
g('.section-a-to-z #a-z-search').hideseek({
list: '.section-a-to-z .view-content',
highlight: false,
navigation: false,
nodata: 'No results found! Please try again using other terms.',
attribute: 'text',
ignore: '.taxonomy-term-description, .field-name-body',
ignore_accents: true
});*/
/* A-Z: Resets text search field: For any click inside text field
g('.section-a-to-z #a-z-search').on('click', function() {
g('html, body').animate({scrollTop: g('.section-a-to-z #a-z-search').offset().top - 120}, 500); // animate scroll to search box
g(this).val('').change(); // Remove value
g(':checkbox[name^=fl]:checked, :radio[name^=fl]:checked').attr('checked', false).change(); // Uncheck all categories
g('.section-a-to-z .view-content > .views-row').show(); // Show all rows for fresh search
});*/
/* A-Z: Clicking a category clears search box
g('.section-a-to-z...