CodeByZach/pace is an open-source project on GitHub with 15.6k stars, written primarily in CSS. Automatically add a progress bar to your site.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Include pace.js and the
theme css of your choice on your page
(as early as possible), and you're done!
Pace will automatically monitor your ajax requests, event loop lag, document
ready state, and elements on your page to decide the progress. On ajax navigation
it will begin again!
If you use AMD or Browserify, require pace.js and call pace.start() as early in the loading process as possible.
Pace is fully automatic, no configuration is necessary to get started.
If you would like to make some tweaks, here's how:
You can set window.paceOptions before bringing in the file:
paceOptions = {
// Disable the 'elements' source
elements: false,
// Only show the progress on regular and ajax-y page navigation,
// not every request
restartOnRequestAfter: false
}
Add your own classes to paceOptions.extraSources to add more sources. Each source should either
have a .progress property, or a .elements property which is a list of objects with
.progress properties. Pace will automatically handle all scaling to make the progress
changes look smooth to the user.
Elements
Elements being rendered to the screen is one way for us to decide that the page has been
rendered. If you would like to use that source of information (not required at all),
specify one or more selectors. You can comma separate the selectors to properly handle
error states, where the progress bar should disappear, but the element we are looking for
may never appear:
Pace will consider the elements test successful when each selector matches something. For
this example, when either .timeline or .timeline-error exist, and either .user-profile
or .profile-error exist.
Restart Rules
Most users want the progress bar to automatically restart when a pushState event occurs
(generally means ajax navigation is occuring). You can disable this:
paceOptions = {
restartOnPushState: false
}
You can also have pace restart on every ajax request which lasts longer than x ms. You'll want to
disable this if you make ajax requests the user doesn't need to know about, like precaching:
paceOptions = {
restartOnRequestAfter: false
}
You can always trigger a restart manually by calling Pace.restart()
See the source for a full list of options.
API
Pace exposes the following methods:
Pace.start: Show the progress bar and start updating. Called automatically if you don't use AMD or CommonJS.
Pace.restart: Show the progress bar if it's hidden and start reporting the progress from scratch. Called automatically
whenever pushState or replaceState is called by default.
Pace.stop: Hide the progress bar and stop updating it.
Pace.track: Explicitly track one or more requests, see Tracking below
Pace.ignore: Explicitly ignore one or more requests, see Tracking below
Events
Pace fires the following events:
start: When pace is initially started, or as a part of a restart
stop: When pace is manually stopped, or as a part of a restart
restart: When pace is restarted (manually, or by a new AJAX request)
done: When pace is finished
hide: When the pace is hidden (can be later than done, based on ghostTime and minTime)
You can bind onto events using the on, off and once methods:
Pace.on(event, handler, [context]): Call handler (optionally with context) when event is triggered
Pace.off(event, [handler]): Unbind the provided event and handler combination.
Pace.once(event, handler, [context]): Bind handler to the next (and only the next) incidence of event
Tracking
By default, Pace will show any ajax requests which begin as a part of a normal or ajax-y page load, or which last longer than
500ms.
You can disable all ajax tracking by setting ajax to false:
Pace.options = {
ajax: false
}
You can disable ajax tracking except on page navigation by setting restartOnRequestAfter to false:
Pace.options = {
restartOnRequestAfter: false
}
You can manually disable tracking for a specific request or requests by triggering them within a Pace.ignore callback:
Pace.ignore(function() {
$.ajax(...)
});
You can force the progress bar to be shown for a specific request by triggering them within a Pace.track callback:
Pace is designed to support IE8+ (standards mode), FF 3.5+, Chrome, Safari 4+, Opera 10.5+, and all modern
mobile browsers. If you run into a compatibility issue, or can make a case for supporting something else,
please create an issue.
Size
pace.js is 4kb minified and gzipped. The themes vary between 0.5 and 4kb.
Issues
We have obviously not tested this on every website. If you run into an issue, or find a way the automatic
detection could be better, please create an Issue. If you can include a test case, that's even better.
The most recent commit recorded on CodeByZach/pace was 9 days ago, based on the GitHub push timestamp. The repository has 1.8k forks — one of the better signals of community interest.
How many stars does CodeByZach/pace have?
CodeByZach/pace has 15.6k GitHub stars — refresh the page for the live number, or check github.com/CodeByZach/pace. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is CodeByZach/pace?
CodeByZach/pace (CodeByZach/pace) is a CSS project on GitHub. From the project's own README: Automatically add a progress bar to your site.
What language is CodeByZach/pace written in?
CodeByZach/pace is written primarily in CSS. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is CodeByZach/pace associated with?
GitHub's repository topics for CodeByZach/pace: "loading-animation", "loading-bar", "loading-indicator", "pace", "pace-js", "progress-bar". TopGit's editorial category is open-source.
Read full README in the tab above.
Still deciding about pace?
One click hands the question to an AI along with this page — see what it says about pace.