Article Word Counter & Reading Time Plugin - jQuery KeepReading

Article Word Counter & Reading Time Plugin - jQuery KeepReading
File Size: 87.8 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

KeepReading is a jQuery plugin that counts the number of words in your article and displays the estimated article reading time inspired by Medium.com.

How to use it:

1. Load the JavaScript file keepreading.js after jQuery library and the KeepReading is ready for use.

<script src="//code.jquery.com/jquery-3.1.1.slim.min.js"></script>
<script src="scripts/keepreading.min.js"></script>

2. Add the CSS class 'keepreading' to your article and then create the DIV elements as shown below to display the word count and estimated article reading time.

<article class="keepreading">
  <h1>Article Title</h1>
  <h5 class="keepreading__time"></h5>
  <span class="keepreading__words"></span>
  <p>Main Content Here</p>
</article>

3. That's it. You're allowed to customize the average Reading Time (words per minute) in the JavaScript as this.

$('article').keepReading({
  averageReadingTime: 240
});

4. More config settings with default values.

$('article').keepReading({

  // target article
  keepReading: $('.keepreading'),

  // for remote article
  keepReadingRemoteTarget: null,
  keepReadingRemotePath: null,

  // displays word count
  keepReadingWordCount: true
  
});

5. Available callback functions.

$('article').keepReading({

  success: function success() {},
  error: function error() {}

});

Change log:

2017-07-12

2017-05-12

  • JS update

2017-03-29

  • Fixed for remote data

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