tcu360 / election-central

This app creates a central location for all SGA election news.
election.tcu360.com
0 stars 0 forks source link

Enable filtering with Isotope.js #31

Closed richardescobedo closed 10 years ago

richardescobedo commented 10 years ago

@achavez Ok – so I attempted to pull this in through this commit 060a1e86006333aae3894919c16bafd6946ad923, but seem to have failed. Where I'm stuck is adding the a class containing the office to each panel wrapper. From there, filtering should be simple using the Isotope API.

Could I use a callback function in line 49 of election-central.js?

achavez commented 10 years ago

So as I see it you have two options: 1) Go ahead and add the class and write a function that will change the office into something that's a legal class name. To turn the office name into a class you'd have to clean it. That'd mean making it lowercase and cleaning non-alphanumerics so you're only left with letters and hyphens. You'd have to do a similar conversion for the content of the href="" on your nav links. 2) Use a custom filtering function. Basically, use the .data() selector like you're doing now. So basically in the example where they're doing $(this).find('.number').text(); you can do $(this).data('office').