This time I will share jQuery Plugin and tutorial about Article Word Counter & Reading Time Plugin – jQuery KeepReading, hope it will help you in programming stack.
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.
1 |
< script src = "//code.jquery.com/jquery-3.1.1.slim.min.js" ></ script > |
2 |
< 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.
1 |
< article class = "keepreading" > |
3 |
< h5 class = "keepreading__time" ></ h5 > |
4 |
< span class = "keepreading__words" ></ span > |
5 |
< p >Main Content Here</ p > |
3. That’s it. You’re allowed to customize the average Reading Time (words per minute) in the JavaScript as this.
1 |
$( 'article' ).keepReading({ |
2 |
averageReadingTime: 240 |
4. More config settings with default values.
01 |
$( 'article' ).keepReading({ |
04 |
keepReading: $( '.keepreading' ), |
07 |
keepReadingRemoteTarget: null , |
08 |
keepReadingRemotePath: null , |
11 |
keepReadingWordCount: true |
5. Available callback functions.
1 |
$( 'article' ).keepReading({ |
3 |
success: function success() {}, |
4 |
error: function error() {} |
Change log:
2017-07-12
2017-05-12
2017-03-29
This awesome jQuery plugin is developed by danielmalmros. For more Advanced Usages, please check the demo page or visit the official website.