Responsive Multi-line Text Truncating In Pure JavaScript – Ellipsis.js

Category: Javascript , Recommended , Text | September 13, 2018
Author: glinford
Views Total: 5,302
Official Page: Go to website
Last Update: September 13, 2018
License: MIT

Preview:

Responsive Multi-line Text Truncating In Pure JavaScript – Ellipsis.js

Description:

Ellipsis.js is a pure JavaScript library for responsive text truncation which enables you to truncate multi-line text within a specified DOM element(s) with ellipsis.

How to use it:

Link to the JavaScript file ‘ellipsis.js’:

<script src="ellipsis.js"></script>

Initialize the Ellipsis, specify the target container and set the maximum lines of text to show after truncating.

Ellipsis({
  class: '.container',
  lines: 3
});

All default configuration options.

Ellipsis({
  ellipsis: '…', // custom ellipsis character
  debounce: 100, // chill out your memory usage on resizing
  responsive: true,
  class: '.clamp',
  lines: 2,
  portrait: null, // default no change, put a number of lines if you want a different number of lines in portrait mode
  break_word: true // truncate words
});

Changelog:

09/13/2018

  • v0.1.3

You Might Be Interested In:


Leave a Reply