Skip to content

Instantly share code, notes, and snippets.

@duncanmcdougall
Created October 22, 2013 10:46
Show Gist options
  • Save duncanmcdougall/7098504 to your computer and use it in GitHub Desktop.
Save duncanmcdougall/7098504 to your computer and use it in GitHub Desktop.
jQuery function to get the number of lines in a **basic** block of text. Only for use on basic blocks of text, no internal elements fuckin with the line-height.
function numberOfLines(selector) {
return $(selector).height()/parseInt($(selector).css('lineHeight'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment