Skip to content

Instantly share code, notes, and snippets.

@pavenuto
Created August 10, 2011 18:29
Show Gist options
  • Save pavenuto/1137710 to your computer and use it in GitHub Desktop.
Save pavenuto/1137710 to your computer and use it in GitHub Desktop.
Script to add letter spacing, line height controls to the Typekit type tester
var $tester = $('#type-tester'),
$textarea = $tester.find("textarea"),
$letter_spacing = $("<input />", {
className: 'letter-spacing',
type: 'text',
id: "#ls",
value: "0.00"
}),
$ls_div = $("<div />",{
text: "Tracking",
}),
$line_height = $("<input />", {
className: 'line-height',
type: 'text',
id: "#lh",
value: "1"
}),
$lh_div = $("<div />",{
text: "Leading",
});
if ($tester.length){
$('<style type="text/css">#type-tester textarea { text-rendering: optimizeLegibility; }</style>').appendTo('head');
$letter_spacing
.appendTo($ls_div)
.bind('keyup', function(){
$textarea.css('letterSpacing', $(this).val() + 'em');
});
$ls_div.prependTo($tester);
$line_height
.appendTo($lh_div)
.bind('keyup', function(){
$textarea.css('lineHeight', $(this).val() + 'em');
});
$lh_div.prependTo($tester);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment