Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Truncate text to be a specific height.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.md
jquery.ui.truncate.js

README.md

jQuery UI widget designed for truncating text in a browser to a specific height. This is much better than truncating text to a specific string length because that method is extremely imprecise.

For instance, it can be quite difficult to truncate text down to four lines. Using text lenght alone might result in a string that is 3 lines or 5 lines depending on the characters involved. Imagine truncating a commend that is made entirely of "w" or only "i". You can fit a lot more i's on 4 lines than you can fit w's.

$('div').truncate( { height: 100} );

NOTE: currently the height property should not contain units.

Something went wrong with that request. Please try again.