-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
progress visible when browser's back button used #8
Comments
Oh... clever. Let's see what we can do. |
Okay, got it. This should be bullet proof now: $(document).on('page:fetch', function() { NProgress.start(); })
$(document).on('page:change', function() { NProgress.done(); })
$(document).on('page:restore', function() { NProgress.remove(); }) And ensure that you're using Turbolinks 1.3.0+. I'm not sure when Here's the rationale:
|
Apparently this solution does not works for Wiselinks: https://github.com/igor-alexandrov/wiselinks. |
If anyone has code on integrating NProgress with Wiselinks, please open a new issue. I'd happily add it to the documentation. |
Turbolinks recently added |
for the new v5 the method will be $(document)
.on('turbolinks:click', function() {
NProgress.start();
})
.on('turbolinks:render', function() {
NProgress.done(); // to work with the above method on first visit
NProgress.remove(); // to work on back btn click, restore event
}); |
Thanks! I've updated the turbolinks instructions. https://github.com/rstacruz/nprogress/blob/master/Readme.md#turbolinks-version-5 |
Dear @ctf0, is this necessary? Without that code I can use very good nprogress. Why? |
@mrkongo u dont need to use the code if it serves no purpose to u, basicly its a solution for the main issue "having nprogress visible on going back" |
@rstacruz after more testing its recommended to use TL default progress instead of nprogress as its inaccurate , actually even TL progress is not perfect but the margin of false progress is smaller than nprogress. |
Update turblinks v5 events, as recommended by nprogress (rstacruz/nprogress#8 (comment)) I've tested both versions. This gives better UX, imo. There is no delay between clicking a link, and the loading bar appearing, even on really slow connections.
Steps to reproduce:
The text was updated successfully, but these errors were encountered: