Skip to content

Instantly share code, notes, and snippets.

@gaving
Created October 31, 2010 16:04
Show Gist options
  • Select an option

  • Save gaving/656759 to your computer and use it in GitHub Desktop.

Select an option

Save gaving/656759 to your computer and use it in GitHub Desktop.
script.js
$(document).ready(function() {
$(".entry-title a").lettering();
$.fn.stripTags = function() { return this.replaceWith( this.html().replace(/<\/?[^>]+>/gi, '') ); };
$("span").each(function(i, el) {
var html = $(el).html().replace(/\s+/, "");
if ($(el).is(":empty") || html.length == 0)
$(el).stripTags();
});
var c = [ 'grey','green','blue','lightBlue','orange', 'red' ];
$(".entry-title a span").randomClass( c, { randomness: 'successive', removeClasses: true } );
$(".entry-title").each(function () {
var charLength = $(this).text().length;
if (charLength >= 1) $(this).css({'font-size' : '100px', 'line-height' : '70px'});
if (charLength >= 9) $(this).css({'font-size' : '95px', 'line-height' : '65px'});
if (charLength >= 11) $(this).css({'font-size' : '90px', 'line-height' : '60px'});
if (charLength >= 13) $(this).css({'font-size' : '85px', 'line-height' : '55px'});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment