Skip to content

Instantly share code, notes, and snippets.

@jimmylee
Created May 8, 2019 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmylee/3049c85c0b34538bb7c28c36e14665a4 to your computer and use it in GitHub Desktop.
Save jimmylee/3049c85c0b34538bb7c28c36e14665a4 to your computer and use it in GitHub Desktop.
NProgress with anchors and nextjs
// NOTE(jim): This is a little hacky because we actually make server trips.
if (process.browser) {
NProgress.configure({
showSpinner: false,
easing: 'ease',
speed: 300,
minimum: 0.8,
});
NProgress.done(true);
window.onbeforeunload = function() {
NProgress.configure({
showSpinner: false,
easing: 'ease',
speed: 500,
minimum: 0.08,
});
NProgress.start();
};
window.onunload = function() {
NProgress.done();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment