luis-almeida / filtrify

Beautiful advanced tag filtering with HTML5 and jQuery
Other
642 stars 112 forks source link

Capitalize Filter Name #15

Open kylepfeeley opened 12 years ago

kylepfeeley commented 12 years ago

Hey there, is there a way to get the title of the filter to be capitalized?

I've tried playing around with the HTML list item's "data" name. And, with the CSS's "text-transform: capitalize;" command, but neither method works. My guess is that the case of the filter title gets stripped because it's being assigned in the jQuery commands themselves. I notice on your example pages all the filter titles are in lowercase lettering.

I love the filter program. Thanks for building it. I'm a novice when it comes to jQuery, so this is a huge help.

gvilcins commented 12 years ago

I had the same problem, here's my solution. Since "text-transform" didn't work cross-browser, I added to the JS file.

Right after: field = name.replace(/data-/gi, "").replace(/-/gi, " ");

Insert this on the next line: field = field.toLowerCase().replace(/\b[a-z]/g, function(letter) { return letter.toUpperCase(); });

That seemed to work for me.

kylepfeeley commented 12 years ago

That's great! Thank you @gvilcins . I'll use your solution next time. This time I did a workaround: used CSS's "content" element to add a capitalized filter title in place of the icon font. The only catch is that you lose the little bulleted icon. My client liked the look of it though.

adrianthedev commented 11 years ago

Thank`s for the solution!