🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

jQuery.smarttruncation truncates the text within the assigned element to fit and updates the string length while resizing the window.The used technique is very responsive, since it calculates the width for each character in a pre-define set ahead of time. The generated sizes dictionary is cached and re-used if the plugin is called on an element with identical font properties.

Plugins Text Effect

Documentation

Usage

Basic options

$('.text li').smartTruncation();

Settings and defaults

$('.text-2 li').smartTruncation({   "truncateCenter" : true // "Hello World" -> "hel..rld" }); $('.files li').smartTruncation({   "protectExtensions" : true // "myimagefile.jpg" -> "myimagef...jpg" });

Get more info and try a demo here.

The plugin currently doesn't work too well with tables (and I realize that that's a big usecase). It's all about the CSS. If you can provide a properly scaling block-level container around the element you want to truncate, then you should be good to go. CSS is your friend.


You May Also Like