Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Adding the letter to the class #2

Closed
Boldewyn opened this issue Sep 15, 2010 · 7 comments
Closed

Feature: Adding the letter to the class #2

Boldewyn opened this issue Sep 15, 2010 · 7 comments
Labels

Comments

@Boldewyn
Copy link

The plugin could be extended in the following way: To the char# class, add also a letter-X class, where X is the content of the span.

Example:

Current result:

<span class="char1">A</span>

Proposed result:

<span class="char1 letter-A">A</span>

Side effects: Whitespace must be addressed specially.

Advantages: In the CSS you could address all 'A's at once, like, e.g., doing baseline shifting.

@davatron5000
Copy link
Owner

Great idea. Something similar was mentioned in the blog comments. It's not without its challenges (i.e. apostrophes and other punctuation), but my brain is turning on this. Will likely make it into the next version with something like: $(".fancy_title").lettering('letterize'); ...

but don't quote me on that. :)

@Boldewyn
Copy link
Author

Apostrophes shouldn't be an issue, since there are no quotes to escape in the DOM ;-). And in the stylesheets, there are escape mechanisms. However, metaclasses, like letter-punctuation or so could prove useful.

Apart from that: Thanks for the cool plugin!

@roborourke
Copy link

My fork of the plugin has this feature plus a few others. Take a look.

It also supports non alpha-numeric characters by way of escaping the characters and then replacing the % sign with the letter u meaning an ampersand would get the class name .char-u26 or if using the words method .word-u26. Spaces are .char-u20 etc..

@scottmackenzzz
Copy link

@sanchothefat - Perfect! Save my day.

@ianthedev
Copy link

Please also consider adding a class for each word:

<p>
    <span class="word1 lorem">Lorem</span>
    <span class="word2 ipsum">ipsum</span>
    <span class="word3 dolor">dolor</span>
    <span class="word4 sit">sit</span>
    <span class="word5 amet">amet</span>
</p>

@davatron5000
Copy link
Owner

If you need this functionality, check out @sanchothefat's fork https://github.com/sanchothefat/Lettering.js

I'm personally not convinced that after a few years this needs to go into core.

If you need this sorta functionality, you can hack it in (with mixed results), like so:

$('#mything').lettering('words').children('span').each( function(){ 
  $(this).addClass($(this).text().toLowerCase()); 
});

@drawcard
Copy link

drawcard commented May 2, 2013

Sorry davatron5000, I deleted my old comment when I realised it's probably not necessary either - but I like your solution anyhow :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants