Tiny Estimated Reading Time jQuery Plugin - reading-time.js

File Size: 5.81 KB
Views Total: 260
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Tiny Estimated Reading Time jQuery Plugin - reading-time.js

Have you ever wanted to know how long people spend reading your blog posts? Or maybe how long it takes people to read your product descriptions? Well, that's what this plugin is made for.

reading-time.js is a tiny (less than 1kb minified) and easy-to-use jQuery plugin that can help you indicate how much time the user will be spending reading your content. It will calculate the total number of words in the text-based content post and displays the estimated reading time on the page based on a specific reading speed (defaults to 250 words per minute)

How to use it:

1. Download and put the main Javascript jquery-reading-time.js after loading the latest jQuery.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/js/jquery-reading-time.js"></script>

2. Calculate the estimated reading time of your content.

<div id="post">
  ...
</div>
var rt = $('#post').readingTime();
// =>
{
  // Reading time in minutes (rounded)
  minutes: 1,   
  // Reading time in seconds
  seconds: 49,  
  // Reading time string "minutes:seconds"
  str: "00:49", 
  // Word count (integer)
  words: 208    
}

3. Override the default reading speed (words per minute).

var rt = $('#post').readingTime({
    WPM: 200,
});

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