Author: | Tikubonn |
---|---|
Views Total: | 215 views |
Official Page: | Go to website |
Last Update: | August 30, 2018 |
License: | MIT |
Preview:

Description:
omitter.js is a fast JavaScript text truncation plugin to limit your long text to a specific number of lines using Element.innerText or TextNode.data.
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.
omitter.omit();
Disable the omitter.
omitter.unomit();
Update the omitter.
omitter.update();
Toggle the omitter.
omitter.toggle();