Skip to content

Feature: Wrap all letters in a specific class #73

@lakhman

Description

@lakhman

This is an awesome plugin, it's exactly what I need and has great performance.

The only issue for my use case, is that I want every letter to have a span, rather than class="char4".

Example:

<!-- Current -->
<span class="char1" aria-hidden="true">C</span>
<span class="char2" aria-hidden="true">O</span>
<span class="char3" aria-hidden="true">N</span>
<span class="char4" aria-hidden="true">T</span>
<span class="char5" aria-hidden="true">E</span>
<span class="char6" aria-hidden="true">N</span>
<span class="char7" aria-hidden="true">T</span>
<span class="char8" aria-hidden="true">S</span>

<!-- Is this possible? (Each letter has a specific class) -->
<!-- Notice: 'char-t' is being used twice  -->
<span class="char-c" aria-hidden="true">C</span>
<span class="char-o" aria-hidden="true">O</span>
<span class="char-n" aria-hidden="true">N</span>
<span class="char-t" aria-hidden="true">T</span>
<span class="char-e" aria-hidden="true">E</span>
<span class="char-n" aria-hidden="true">N</span>
<span class="char-t" aria-hidden="true">T</span>
<span class="char-s" aria-hidden="true">S</span>

So all the letter is lowercased, then added a class that we can style that individual letter with?

I managed to do this via: (to fit my needs for now).. but could be a useful plugin feature seeing as there is no other libraries that do this.

    // Within jquery.letter.js line 20
    inject += '<span class="'+klass+(item)+'" aria-hidden="true">'+item+'</span>'+after;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions