Created
April 14, 2016 08:08
-
-
Save rambuvn/a060f3003294aa815f4f48b549e8ce69 to your computer and use it in GitHub Desktop.
This file contains 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
$('.stretch-text').each(function(index, el) { | |
var line = $(el); | |
line.html('<span class="stretch-it">'+line.text()+'</span>'); | |
var text = line.find('.stretch-it' ); | |
var textLength = line.text().length, | |
textWidth = text.width(); | |
var spacing = line.width() - textWidth; | |
var lt_spacing = spacing / textLength; | |
line.css('letter-spacing', lt_spacing + 'px' ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment