Created
October 14, 2018 05:26
-
-
Save baras/def87a9d32ca8aad07628e606af2a1ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Wrap each letter of text in the given element in a span tag. | |
*/ | |
$.fn.lettering = function () { | |
this.each(function (index) { | |
var elem = $(this), | |
characters = elem.text().split(""); | |
elem.empty(); | |
$.each(characters, function (i, el) { | |
elem.append('<span>' + el + "</span"); | |
}); | |
}); | |
return this; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment