Versatile Responsive Text Truncation Plugin For jQuery - Truncate.js

File Size: 44.3 KB
Views Total: 1303
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Versatile Responsive Text Truncation Plugin For jQuery - Truncate.js

Just another responsive, multi-line text truncation plugin for jQuery that allows to truncate overflowed content by lines or container's height.

Features:

  • Truncate text to fit within its container with a fixed height.
  • Truncate text to a specific number of lines.

How to use it:

1. Just include the main JavaScript jquery.truncate.js after JQuery library and you're ready to go.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/dist/truncate.min.js"></script>

2. Truncate your text to fit the height of its parent container.

<div class="demo1"> 
  ...
</div>
.demo1 { height:100px; }
$('.demo1').truncate();

3. Truncate your text to a specific number of lines.

$('.demo2').truncate({
  lines: 3
});

Changelog:

2020-07-07

  • Fix dependencies

This awesome jQuery plugin is developed by castlegateit. For more Advanced Usages, please check the demo page or visit the official website.