Calculate Reading Time for a Blog
Compiled and production-ready code can be found in the dist
directory.
Direct Download
You can download the files directly from GitHub.
<script src="dist/readingTime.min.js"></script>
CDN
<script src="https://unpkg.com/[email protected]/dist/readingTime.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/readingTime.min.js"></script>
NPM
npm i aks-reading-time
<div class="blog-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam luctus diam at nibh varius, a condimentum ante tristique. Integer ut tempor metus. Etiam fringilla auctor sapien ut fermentum.</p>
<p>Fusce porttitor sit amet nisi eu tincidunt. Donec volutpat nunc in tempor mollis. Donec vehicula dignissim nisl, eget porta purus vestibulum vel.</p>
<p>...</p>
</div>
<div class="result"></div>
const BlogReadingTime = new readingTime({
read: ".blog-content", // text container in which reading speed will be measured
result: ".result", // html element showing results
speed: 1 // the number of words read per second
});
const BlogReadingTime = new readingTime({
read: ".blog-content",
result: ".result",
speed: 1,
// other options
secondText: 'Sec Read', // default value "Sec Read"
minuteText: 'Min Read', // default value "Min Read"
hourText: 'Hour Read', // default value "Hour Read"
dayText: 'Day Read', // default value "Day Read"
});
The code is available under the MIT License.