Made by Jaro Quastenberg

Time 20 January 2018

How to

Code with ALL category

// Dynamic Filter
$(document).ready(function() {
  	// Code#001: Set Slug Variables
  	var slug = function(str) {
    var $slug = '';
    var trimmed = $.trim(str);
    $slug = trimmed.replace(/[^a-z0-9-]/gi, '-').
    replace(/-+/g, '-').
    replace(/^-|-$/g, '');
    return $slug.toLowerCase();

	// Code#002: Add Classes to Collection List Items
  	$('#filter-list .w-dyn-item').each(function () {
    									   // The five Category Text Blocks
      	var category1 = slug($(this).find('.category-inlay:nth-child(1)').text());
      	var category2 = slug($(this).find('.category-inlay:nth-child(2)').text());
      	var category3 = slug($(this).find('.category-inlay:nth-child(3)').text());	
      	var category4 = slug($(this).find('.category-inlay:nth-child(4)').text());
      	var category5 = slug($(this).find('.category-inlay:nth-child(5)').text());
  	// Code#003: Show & Hide Items when Filter Navigation is clicked
 		var navigationCategory = slug($(this).text());
      	setTimeout(function() { $('#filter-list .w-dyn-item').css('display', 'none'); }, 500);
		setTimeout(function() { $('.' + navigationCategory).css('display', 'block'); }, 500);;
  	// Code#004: Show All
      	setTimeout(function() { $('#filter-list .w-dyn-item').css('display', 'block'); }, 500);
  	// Code#005: Set Active for Category "All"


Add the new code to the page you are working on or on site level. What ever you prefer and if you are using the filter on multiple pages. Page: Edit page details > Custom code> Before /body tag Site: Project settings > Custom code > Footer Code

Create the Category CMS Collection.

Create the categories. Create all categories you want + one category called ALL where you set the sort number to 1.

Create the content CMS Collection

Create the CMS content

Create the page content The filter items

Styling the active filter items.

This is to difference the inactive and active filter item. I set the inactive (initial state) to 60% opacity. And the Active State to 100% opacity.

The content