NProgressSlim progress bars for Ajax'y applications. Inspired by Google, YouTube, and Medium.
InstallationAdd nprogress.js and nprogress.css to your project.
<script src='nprogress.js'></script> <link rel='stylesheet' href='nprogress.css'/>
NProgress is available via bower and npm and spm.
$ bower install --save nprogress $ npm install --save nprogress
Basic usageSimply call
done()to control the progress bar.
Using Turbolinks or similar? Ensure you're using Turbolinks 1.3.0+, and use this: (explained
IdeasAdd progress to your Ajax calls! Bind it to the jQuery
Make a fancy loading bar even without Turbolinks/Pjax! Bind it to
Advanced usagePercentages: To set a progress percentage, call
.set(n), where n is a number between
Incrementing: To increment the progress bar, just use
.inc(). This increments it with a random amount. This will never get to 100%: use it for every image load (or similar).
If you want to increment by a specific value, you can pass that as a parameter:
Force-done: By passing
done(), it will show the progress bar even if it's not being shown. (The default behavior is that .done() will not
do anything if *.start()* isn't called)
Get the status value: To get the status value, use
Changes the minimum percentage used upon starting. (default:
You can change the markup using
template. To keep the progress bar working, keep an element with
role='bar'in there. See the default template for reference.
Adjust animation settings using easing (a CSS easing string)
and speed (in ms). (default:
Turn of the automatic incrementing behavior by setting this to
You can adjust the trickleRate (how much to increase per trickle) and
trickleSpeed (how often to trickle, in ms).
Turn off loading spinner by setting it to false. (default:
specify this to change the parent container. (default:
nprogress.cssto your liking. Tip: you probably only want to find and replace occurrences of
The included CSS file is pretty minimal... in fact, feel free to scrap it and make your own!
ResourcesNew UI Pattern: Website Loading Bars (usabilitypost.com)
SupportBugs and requests: submit them through the project's issues tracker.
Questions: ask them at StackOverflow with the tag nprogress.
Chat: join us at gitter.im.
ThanksNProgress © 2013-2014, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors.
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz