Medium Inspired jQuery Read Time Estimating Plugin - readtime

File Size: 7.37 KB
Views Total: 9739
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Medium Inspired jQuery Read Time Estimating Plugin - readtime

A minimal jQuery plugin for calculating the read time for the words and images and displaying an estimated time on your web page. Based on Medium's Read Time and You article:

 Read time is based on the average reading speed of an adult (roughly 275 WPM). We take the total word count of a post and translate it into minutes. Then, we add 12 seconds for each inline image. 

See also:

How to use it:

1. Include jQuery library and the jQuery read time plugin at the bottom of your web page.

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="jquery.readtime.js"></script>

2. Wrap the content you wish to calculate the read time into a container.

<article>
  Your content goes here
</article>

3. Call the plugin. The plugin will display a read time at the top of the container you just created.

$('article').readtime({
class:   'readtime',   // Class name of the output element
format:  '# min read', // # == the number of minutes
images:  12,           // Seconds per image, false to disable
wpm:     275,          // Words per minute, defaults to average
wrapper: 'time'        // What the output will be wrapped in
});

Change log:

2014-09-04

  • added more options.

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