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
$.fn.truncateLines = function(options) { | |
options = $.extend($.fn.truncateLines.defaults, options); | |
return this.each(function(index, container) { | |
container = $(container); | |
var containerLineHeight = Math.ceil(parseFloat(container.css('line-height'))); | |
var maxHeight = options.lines * containerLineHeight; | |
var truncated = false; | |
var truncatedText = $.trim(container.text()); | |
var overflowRatio = container.height() / maxHeight; |