Easy jQuery Text Truncation & Read More Plugin - Curtail

File Size: 4.9 KB
Views Total: 2725
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Easy jQuery Text Truncation & Read More Plugin - Curtail

Curtail is a lightweight jQuery plugin that truncates text to a specified number of characters (250 by default) and generates a 'Read More' link allowing the visitor to reveal the truncated text.

See also:

Basic Usage:

1. Include jQuery library and the jQuery curtail plugin at the bottom of your Html.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="jQuery.curtail.js"></script>

2. Wrap your text into a container element and create a 'read more' link at the end of the text.

<div class="example">
  <p>Your Long Text Here</p>
  <a href="#" class="btn">Read More</a> 
</div>

3. Call the plugin on the text wrapper and done.

$('.example').curtail();

4. Customize the plugin.

$('.example').curtail({

// the number of character to be displayed
limit: 250,

// custom the ellipsis
ellipsis: '...'

});

Change logs:

2015-04-13

  • improvement.

2015-02-10

  • Spelling fix

2015-01-28

  • typo fix. ellipse-->ellipsis

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