https://github.com/kinduff/readpercent
Simple jQuery plugin to get the percent of a div scrolled inside the viewport.
https://github.com/kinduff/readpercent
Last synced: 14 days ago
JSON representation
Simple jQuery plugin to get the percent of a div scrolled inside the viewport.
- Host: GitHub
- URL: https://github.com/kinduff/readpercent
- Owner: kinduff
- Created: 2014-04-16T17:31:10.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-17T00:07:15.000Z (about 12 years ago)
- Last Synced: 2025-01-03T20:12:56.674Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 641 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
readpercent.js
===========
## Welcome
This is a jQuery plugin that offers an easy way to show reading progress to your users. There are a few ways to get the percentage value. Make sure to checkout the demo inside this page.
## Demo
[Check it out](http://kinduff.github.io/readpercent/).
## Install
Make sure to include jQuery in your page.
```html
```
And then include **readpercent.js**
```html
```
## Usage
Works as a normal jQuery plugin.
### Get raw percent (0-100)
```javascript
$('#content').readpercent();
```
### Get rounded percent (0-100)
```javascript
$('#content').readpercent(true);
```
I recommend you to append the previous methods to a `$(window).scroll` event to get live data.
### Fill HTML5 Progress Element
```javascript
$("#content").readpercent('#progress');
```
### Change width (%) of an element
```javascript
$("#content").readpercent('#container', '.bar');
```