An open API service indexing awesome lists of open source software.

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.

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');
```