Created
May 8, 2019 01:10
-
-
Save jimmylee/3049c85c0b34538bb7c28c36e14665a4 to your computer and use it in GitHub Desktop.
NProgress with anchors and nextjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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