Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 810 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 810 Bytes

filter.js

A very basic jQuery filter plugin. Show/hide elements based on selected tags.

Usage

$(element).filter({
		nav: '[data-filter]' // selector for filter nav (optional)
});

Set the tag to filter with data-filter, eg:

<a data-filter="tag">Tag</a>

Filterable elements should have their tags comma separated in data-filter-tags, eg:

<div data-filter-tags="tag1,tag2,tag3">This is a block</a>

Demo

JSFiddle

Support

I haven't done much testing on this script, and it could probably be more flexible. It requires an element be matched to all selected tags, this could be set to be more loose (etc).

Suggestions/bugs welcome through Issues