jQuery Plugin For Truncating Text with Read More Links - jReadMore

File Size: 7.94 KB
Views Total: 3734
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin For Truncating Text with Read More Links - jReadMore

jReadMore is an ultra light jQuery plugin that truncate your long text to a specified height with "Read more" and "Read Less" links for expanding / collapsing overflowing content.

How to use it:

1. Load jQuery library and the jQuery jReadMore plugin at the end of the document for faster loading.

<script src="jquery.min.js"></script>
<script src="read-more.min.js"></script>

2. Add your long blocks of text into a div element. You can specify the max height option via data-option attribute on this div element.

<div class="read-more" data-options="150">
  Your TEXT HERE
</div>

3. Call the function to initialize the plugin.

$('.read-more').readMore();

4. Pass the option during initialization.

$('.read-more').readMore({
  readMoreLinkClass: "read-more__link",
  readMoreText: "Read more",
  readLessText: "Read less",
  readMoreHeight: 150
});

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