Skip to content

Instantly share code, notes, and snippets.

@kswlee
Created June 21, 2013 15:56
Show Gist options
  • Select an option

  • Save kswlee/5832191 to your computer and use it in GitHub Desktop.

Select an option

Save kswlee/5832191 to your computer and use it in GitHub Desktop.
$.fn.lineHeight = function() {
if (this.length <= 0) return 0;
var clone = $(this[0]).clone().empty().appendTo($('body')).html('&nbsp;');
var baseheight = clone.height();
clone.html('&nbsp;<br>&nbsp;');
var lineheight = clone.height() - baseheight;
clone.remove();
return lineheight;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment