diff --git a/examples/index.html b/examples/index.html index 97283ce..a022e05 100644 --- a/examples/index.html +++ b/examples/index.html @@ -80,7 +80,7 @@

The jQuery

The Result

-

Rainbow

+

Rainbow 🌈

@@ -91,7 +91,7 @@

Words

The Result

-

Hi, Multi Color

+

Hi, Multi Color 😎

@@ -101,7 +101,7 @@

Lines

The Result

-

This is an amazing
Revolution in Typography.
The possibilities are endless:
Coloring, Vertical spacing, and Kerning.

+

This is amazing!😂😂
Revolution in Typography.
The possibilities are endless:
Coloring, Vertical spacing, and Kerning.

@@ -120,7 +120,7 @@

Advanced #2: Chaining and Styling

.children("span").css({'display':'inline-block', '-webkit-transform':'rotate(-25deg)'});

The Result

-

WOOOoo!

+

WOOOoo!😎

diff --git a/jquery.lettering.js b/jquery.lettering.js index 70aae46..9dfd8a2 100644 --- a/jquery.lettering.js +++ b/jquery.lettering.js @@ -11,9 +11,9 @@ * Date: Mon Sep 20 17:14:00 2010 -0600 */ (function($){ - function injector(t, splitter, klass, after) { + function injector(t, splitter, klass, after, match) { var text = t.text() - , a = text.split(splitter) + , a = match ? text.match(splitter) : text.split(splitter) , inject = ''; if (a.length) { $(a).each(function(i, item) { @@ -31,7 +31,7 @@ init : function() { return this.each(function() { - injector($(this), '', 'char', ''); + injector($(this), /([\u0000-\u007F])|([^\u0000-\u007F]+)/g, 'char', '', true); }); }, @@ -39,7 +39,7 @@ words : function() { return this.each(function() { - injector($(this), ' ', 'word', ' '); + injector($(this), /\s/g, 'word', ' ', false); }); }, @@ -55,6 +55,7 @@ injector($(this).children("br").replaceWith(r).end(), r, 'line', ''); }); + } };