Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ specify this to change the parent container. (default: `body`)
NProgress.configure({ parent: '#container' });
~~~

#### `rtl`
Change the progress direction to right-to-left. (default: `false`)

~~~ js
NProgress.configure({ rtl: true });
~~~

Customization
-------------

Expand Down
4 changes: 3 additions & 1 deletion nprogress.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
trickle: true,
trickleSpeed: 250,
showSpinner: true,
rtl: false,
barSelector: '[role="bar"]',
spinnerSelector: '[role="spinner"]',
parent: 'body',
Expand Down Expand Up @@ -242,7 +243,7 @@
progress.innerHTML = Settings.template;

var bar = progress.querySelector(Settings.barSelector),
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
perc = fromStart ? toBarPerc(0) : toBarPerc(NProgress.status || 0),
parent = document.querySelector(Settings.parent),
spinner;

Expand Down Expand Up @@ -325,6 +326,7 @@
*/

function toBarPerc(n) {
if (NProgress.settings.rtl) return (1 - n) * 100;
return (-1 + n) * 100;
}

Expand Down