Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
223 lines (162 sloc) 16 KB
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="Filtrify">
<meta name="keywords" content="javascript, jquery, filtering, filter, plugin" />
<meta name="author" content="Luís Almeida">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/sunburst.css">
<script src="//"></script>
<script src="js/highlight.pack.js"></script>
<script src="js/script.js"></script>
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="">Upgrade to a different browser</a> or <a href="">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
<div id="header" role="banner">
<h1><a href="">filtrify</a></h1>
<h2>Beautiful advanced tag filtering with HTML5 and jQuery</h2>
<p>by the same author of <a href="">jPages</a>, <i>Luís Almeida</i></p>
<a href="" class="twitter-follow-button" data-show-count="false">Follow @lmgalmeida</a>
<a href="" class="twitter-share-button" data-url="" data-text="Filtrify - Beautiful advanced tag filtering with HTML5 and jQuery" data-via="lmgalmeida" data-related="lmgalmeida">Tweet</a>
<iframe src="//;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe>
<!--<div class="g-plusone" data-size="medium" data-href=""></div>-->
<div id="main" role="main">
<div id="content">
<div id="browsers"><em>IE7 - [buggy}</em> <em>IE8+, Chrome, Firefox, Opera, Safari - (tested)</em></div>
<h2 id="what">What?</h2>
<p>Filtrify is an advanced tag filtering plugin, inspired by <a href="" target="_blank">Chosen</a> multiple select feature and Orman Clark’s <a href="" target="_blank">Vertical Navigation Menu</a>.</p>
<p>Advanced because you can search tags within tags and filter items by multiple tags from different categories and get a live feedback on the number of items containing related tags.</p>
<h2 id="how">How?</h2>
<p>Filtrify makes use of the new HTML5 "data" attribute to store the metadata.</p>
<p>All you have to do is include a "data" attribute for each item in your list with the respective tags (metadata). If you have more than one category of tags, include them in another "data" attribute. You can add as much categories of tags as you need.</p>
<p>Filtrify will then go through all the data attributes you included in your items and it will create a search menu with as many fields as the different number of categories (data-attributes) you provided. Each field label in the menu fires a "popup" filtering panel and there's where all the magic happens.</p>
<p>The plugin instanciation is very simple, you just have to pass a "containerID" and a "placeHolderID" which is the ID of the element where you want to place the menu.</p>
<h2 id="usage">Usage</h2>
<p>Add jQuery, filtrify.js and filtrify.css to the &lt;head&gt; section of your page (correct file locations first):</p>
<pre class="html"><code>&lt;script src="//"&gt;&lt;/script&gt;
&lt;script src="js/fitrify.js"&gt;&lt;/script&gt;
&lt;link rel="stylesheet" href="css/filtrify.css"&gt;
<p>The HTML markup is really easy to understand and set up. You just have to be careful about these five things:</p>
<li>Insert the tags separated by <strong>", "</strong> (It's important that you leave a space after the comma).</li>
<li>Equal tags must always have the exact same text (case sensitive!).</li>
<li>If a tag has ", " in its text, you have to insert "\" before and after the comma, e.g., imagine "foo, bar" is a tag, you'd have to insert it like this: "foo\,\ bar".</li>
<li>Always use the same sequence of categories in all your items in case that you have more than one category of tags.</li>
<li>Try not to repeat the same tags in a category.</li>
<p>So, imagine that you have a list of singers/bands and each one of them have a list of "genre" tags. Your HTML would have to look like this:</p>
<pre class="html"><code>&lt;div id="placeHolder"&gt;&lt;/div&gt;
&lt;ul id="container"&gt;
&lt;li data-genre="pop, rock, british, classic rock"&gt; The Beatles &lt;/li&gt;
&lt;li data-genre="rock, british, blues, classic rock"&gt; The Rolling Stones &lt;/li&gt;
&lt;li data-genre="alternative, electronic, female vocalists"&gt; Björk &lt;/li&gt;
&lt;li data-genre="rock, alternative, grunge"&gt; Foo Fighters &lt;/li&gt;
&lt;li data-genre="rock, classic rock"&gt; Bruce Springsteen &lt;/li&gt;
<p>Then you just have to instantiate the plugin when the document is ready and pass the "containerID" and "placeHolderID":</p>
<pre class="javascript"><code>$(function() {
$.filtrify("container", "placeHolder");
<p>And that's it! Check out the demos below to see it in action.</p>
<h2 id="demos">Demos</h2>
<li><a href="music.html">Single category</a></li>
<li><a href="movies.html">Multiple categories</a></li>
<li><a href="isotope.html">Isotope integration</a></li>
<li><a href="highlight.html">Highlight matched items with the callback function</a></li>
<li><a href="legend.html">Add a legend with the callback function</a></li>
<li><a href="query.html">Instantiate with a custom query</a></li>
<li><a href="trigger.html">Trigger a custom query</a></li>
<li><a href="reset.html">Reset all filters</a></li>
<li><a href="close.html">Close panel after adding a tag</a></li>
<li><a href="block.html">Block "data" attributes from being added as categories</a></li>
<li><a href="lazyload.html">Load images with Lazy Load</a></li>
<li><a href="jpages.html">Add pagination with jPages</a></li>
<h2 id="style">Style</h2>
<p>Filtrify default looks was inspired by Orman Clark’s <a href="" target="_blank">Vertical Navigation Menu</a> - see <a href="">tutorial</a>.</p>
<p>The plugin CSS file might look a bit confusing and long at the begining but I'm sure you'll find it easy to costumize after inspecting the HTML for just a bit.</p>
<p>Filtrify relies heavily in the ":before" and ":after" pseudo-elements and in the "content" property. If you're not familiar with them, here is a great <a href="">article</a> to get started. Don't forget that IE8 only supports the "content" property if a !DOCTYPE is specified. If you also want to fully support IE7 you can try <a href="">IE7.js</a> (not tested!).</p>
<p>For the icons, I used <a href="">fontomas</a> to extract only the icons being used from the <a href="">web symbols</a> and <a href="">iconic</a> webfonts. Don't forget to include the font files and correct the url in the CSS file.</p>
<h2 id="documentation">Documentation</h2>
<pre><code>$.filtrify( containerID, placeHolderID, options );</code></pre>
<dt>containerID <i>string</i> <i class="required">required</i></dt>
<dd>The ID of the container of the items you want to apply the plugin to.</dd>
<dt>placeHolderID <i>string</i> <i class="required">required</i></dt>
<dd>The ID of the element where you want to place the generated menu.</dd>
<dt>options <i>object</i> <i class="opcional">optional</i></dt>
<dd>Plugin options. See below.</dd>
<h3>Options [type] [default]:</h3>
<dt>noresults <i>String</i><i class="default">"No results match"</i></dt>
<dd>In this parameter you can set the "No results" search text when you're searching for tags.</dd>
<dt>hide <i>Boolean</i><i class="default">true</i></dt>
<dd>By default filtrify hides all the items that don't match the filtering query. If you set hide to false, filtrify will no longer hide the mismatched ones. Because you can still have access to the matched and mismatched items in the callback function, you can then do whatever you want with the result of the query. See the <a href="highlight.html">highlight demo</a>.</dd>
<dt>close <i>Boolean</i><i class="default">false</i></dt>
<dd>If you want the filtering panel to close after adding a tag, set close to "true". See <a href="close.html">demo</a>.</dd>
<dt>query <i>Object</i><i class="default">no default</i></dt>
<dd>You can instantiate the plugin with a default filtering query. This parameter receives an object with the same sturcture as the trigger method (See below). See <a href="query.html">demo</a>.</dd>
<dt>block <i>Array</i><i class="default">empty array</i></dt>
<dd>Filtrify goes through all the "data" attributes in your items and assumes they are all categories of metadata. If you need to use a data attribute to store some information and you don't want the plugin to index it as a category, you can add that "data" attribute to the block list. Filtrify won't think it's a category anymore. See <a href="block.html">demo</a>.</dd>
<dt>callback <i>function</i><i class="default">function (query, match, mismatch) {}</i></dt>
<dd>In this parameter you can pass a function that will run everytime a tag is added or removed. This function receives three arguments: The filtering query (object) and two HTML collections: the matched items (match) and the mismatched ones (mismatch).</dd>
<dd>There are a lot of interesting things you can do using the callback function, like adding a <a href="legend.html">legend</a>, <a href="highlight.html">highlighting matched items</a>, or even adding <a href="jpages.html">pagination, animations and lazy loading of images</a> with jPages, Animate.css and lazyload.</dd>
<dt>Create an instance</dt>
<dd><pre><code>var ft = $.filtrify("containerID", "placeHolderID");</code></pre></dd>
<dd><pre><code>var query = {
category1 : [tags],
category2 : [tags],
ft.trigger( query );</code></pre></dd>
<p>See <a href="trigger.html">trigger</a> and <a href="reset">reset</a> demos to have a better understanding of their usage.</p>
<h2 id="download">Download</h2>
<p>Download the last version from the project page on <a href="">GitHub</a>.</p>
<h2 id="contact">Contact</h2>
<p>I intend to add more features in the future and especially make Filtrify touch friendly and responsive, but it will all depend on the amount of feedback I have from people actually using it. So if you're using Filtrify let me know!</p>
<p>I'm new to twitter but you can get in touch with me <a style="color:#099;" href="!/lmgalmeida">there</a>. You can also visit my <a style="color:#DCF7DD;" href="">github</a> or send me an <a style="color:#DD4B39;" href="">email</a>.</p>
<p>I didn't have a donate button when I first published this plugin because it is not my intention to make money from it.</p>
<p>I released Filtrify under the MIT license, so it is free for personal <b>and</b> commercial use.</p>
<p>However, I've been receiving a lot of amazing feedback from awfully generous people who often want to buy me a beer in order to show their gratitude for my work.</p>
<p>Donations are also the best way to support the development of Filtrify, allowing me to take some time to add more features in the future.</p>
<p>So if you like the plugin, be so kind as to make a small donation. Donations are made thru Paypal, but you don't need a Paypal account to make a donation.</p>
<p style="margin-bottom: 30px;">Any ammount will be deeply appreciated!</p>
<form action="" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="" width="1" height="1">
<a id="fork" href=""><img src="" alt="Fork me on GitHub"></a>
var _gaq=[['_setAccount','UA-30247115-1'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];