chromawoods / instaFilta

jQuery plugin for performing in-page filtering
MIT License
41 stars 12 forks source link

Category + search/text input #15

Closed cheatus closed 9 years ago

cheatus commented 9 years ago

Hello, thanks for that plugin, it's great :)

I wonder if there is an option to filter categories (with items inside) with text input, not checkbox ? Something like demo no.8 "Categorize/tag items" but instead checkboxes use text/search input ?

Basically when i add "data-instafilta-category="human"" i'd like to search items or category by "human" attribute. For example i have something like this:


input type="text" id="filtering" placeholder="Some text"

class="instafilta-target" data-instafilta-category="human">Gordon Freeman
class="instafilta-target" data-instafilta-category="machine">Wall-E
class="instafilta-target" data-instafilta-category="human,machine,both">RoboCop

var insta = $('#filtering').instaFilta();

/* This will show "Gordon Freeman" and "RoboCop" */
insta.filterCategory('human');

/* This will show "Wall-E" and "RoboCop" */
insta.filterCategory('machine');

/* This will only show "RoboCop" */
insta.filterCategory('both');

And when i type "human" in my input i would like to get "Gordon Freman, RoboCop" items. Is this possible ? If so, could you provide a solution in that matter please ?

My best, Darek.

chromawoods commented 9 years ago

That would be a bit awkward I think, but should be possible. How about if you have another text field that is NOT initializing instaFilta. Then, you create an event handler for it, in which you fire filterCategory on keyup or something?

cheatus commented 9 years ago

Hi Andreas, thanks for response. I actually wrote my own solution :)

Cheers, Darek.