Versatile Responsive Text Truncation Plugin For jQuery - Truncate.js

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

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="//code.jquery.com/jquery.min.js"></script>
<script src="jquery.truncate.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
});

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