Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// great little typographic widow control script from chris coyier
// https://css-tricks.com/preventing-widows-in-post-titles
$("h2 a").each(function() {
var wordArray = $(this).text().split(" ");
if (wordArray.length > 1) {
wordArray[wordArray.length-2] += " " + wordArray[wordArray.length-1];
wordArray.pop();
$(this).html(wordArray.join(" "));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.