filtrify icon indicating copy to clipboard operation
filtrify copied to clipboard

Capitalize Filter Name

Open kylepfeeley opened this issue 12 years ago • 3 comments

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.

kylepfeeley avatar Aug 23 '12 02:08 kylepfeeley

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.

gvilcins avatar Aug 31 '12 20:08 gvilcins

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.

kylepfeeley avatar Aug 31 '12 22:08 kylepfeeley

Thank`s for the solution!

adrianthedev avatar Jan 15 '13 07:01 adrianthedev