Snippets

Very-Very Simple LetteringJS

Just like http://letteringjs.com
This is used to create different style on each letter because each letter has its own class.

// Wrap all char with span
$('.splitWord').children().andSelf().contents().each(function() {
    if (this.nodeType == 3) {
        $(this).replaceWith(
            $(this).text().replace(/(w)/g, "<span class='char'>$&</span>")
        );
    }
});

// Add class .char1, .char2, .char3, ...
$('.splitWord').each(function() {
    $('span.char', this).each(function(i) {
        i = i+1;            
        $(this).addClass('char' + i);
    });
});

Source: http://hompimpaalaihumgambreng.blogspot.com/2012/04/letterin...

Share this snippet

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Please respect the following rules: No advertising, no spam, no keyword in name field. Thank you!