Limit Long Text To X Lines – omitter.js

Category: Javascript , Text | August 30, 2018
Author: Tikubonn
Views Total: 150 views
Official Page: Go to website
Last Update: August 30, 2018
License: MIT


Limit Long Text To X Lines – omitter.js


omitter.js is a fast JavaScript text truncation plugin to limit your long text to a specific number of lines using Element.innerText or

How to use it:

Insert the stylesheet ‘omitter.css’ and JavaScript ‘omitter.js’ into the document.

<link href="omitter.css" rel="stylesheet"> 
<script src="omitter.js"></script>

Create a new Omitter object and specify the text container, number of lines and ellipsis character as follows:

var textContainer = document.querySelectorAll(".omitter-target");
var omitter = new Omitter(textContainer, 5, "..."); // limit to 5 lines.

Truncate the text.


Disable the omitter.


Update the omitter.


Toggle the omitter.


You Might Be Interested In:

Leave a Reply