Shave Javascript plugin - Shave Javascript plugin that truncates text to fit within an element

Shave Javascript plugin that truncates text to fit within an element

Shave Javascript plugin that truncates text to fit within an element based on a set max-height. Shave is a zero dependency javascript plugin that truncates multi-line text to fit within an html element based on a set max-height. It then stores the diff of the original text string in a hidden <span> element following the visible text. This means the original text remains intact!

Shave, compared to other truncation plugins:

  • maintains the original text after truncation.
  • does not require other libraries
  • only requires a selector and a max height
  • is very lightweight; ~1.5kb unminified
  • allows for custom ellipsis strings and class names but doesn’t over complicate
  • is fast and capable of truncating text within lots of elements quickly
  • is additive. It will play nice with other javascript libraries and more truncation features can easily be built with it.

Read more Download Demo

Leave a Reply

Your email address will not be published. Required fields are marked *