Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Reading Time with jquery

$(function () {
    var txt = $(".content").text();
    
    wordCount = txt.replace( /[^w ]/g, "" ).split( /s+/ ).length;

    var readingTimeInMinutes = Math.floor(wordCount / 228) + 1;
    var readingTimeAsString = readingTimeInMinutes + " min";
    
    $('article .reading-time').html(readingTimeAsString);
});
Source by www.coengoedegebure.com #
 
PREVIOUS NEXT
Tagged: #Reading #Time #jquery
ADD COMMENT
Topic
Name
1+7 =