Created
June 28, 2016 07:04
-
-
Save a9/c8db23fa836cffb40a1748650a7bdfe7 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
function countLines(ele) { | |
var styles = window.getComputedStyle(ele, null); | |
var lh = parseInt(styles.lineHeight, 10); | |
var h = parseInt(styles.height, 10); | |
var lc = Math.round(h / lh); | |
console.log('line count:', lc, 'line-height:', lh, 'height:', h); | |
return lc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment