Truncating Overflowing Text By Lines – ellipsed.js

Category: Javascript , Text | June 1, 2020
Views Total:500 views
Official Page:Go to website
Last Update:June 1, 2020


Truncating Overflowing Text By Lines – ellipsed.js


ellipsed.js is a very small(2kb) JavaScript library that truncates your long text to a specific number of lines.


# Yarn
$ yarn add ellipsed
$ npm install ellipsed --save

How to use it:

Just include the ellipsed.js onto the webpage and you’re ready to go.

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

Truncate the text to a specific number of lines you prefer.

// 2 lines
ellipsed('p', 2);
// 3 lines
ellipsed('p', 3);

Available configurations which can be passed as the third parameter to the ellipsed method.

ellipsed('p', 3,{
  // ellipsis character
  replaceStr: '...',
  // recall the function on window resize
  responsive: false,
  // debounce delay in miiliseconds
  debounceDelay: 250,
  // custom delimiter
  delimiter: ' '


v1.5.0 (06/01/2020)

  • Support node selector

v1.4.2 (10/14/2019)

  • Fixed mobile scroll, triggered ellipsed only if screen-width changes

v1.4.1 (09/23/2019)

  • Fix escaped tags when a text doesn’t need ellipsing

v1.4.0 (11/19/2018)

  • feat: optional delimiter param

v1.3.1 (06/17/2018)

  • fix for formatted content

You Might Be Interested In:

Leave a Reply