Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Actual loading progression with pjax ? #22

Closed
ghost opened this issue Aug 26, 2013 · 12 comments
Closed

Actual loading progression with pjax ? #22

ghost opened this issue Aug 26, 2013 · 12 comments

Comments

@ghost
Copy link

ghost commented Aug 26, 2013

I'm sorry if it has been answered elsewhere, but I only found documentation with turbolinks, but not pjax. How can I configure nprogress so it displays the "true" loading % progress of pjax requests ?

Thanks a lot !

This is my code :

$(document).pjax('a', '#pjax-container');
$(document).on('pjax:send', function() { NProgress.start(); })
$(document).on('pjax:complete', function() { NProgress.done(); })
$(document).on('pjax:timeout', function(event) { event.preventDefault(); })

From what I get it "simulates" loading, but not the actual progression. Is such a thing even possible ?

@ghost
Copy link
Author

ghost commented Aug 26, 2013

Yeah, This is the code I have too. But it's more like a simulation of the actual progress right ?

@caarlos0
Copy link

Yes
On Aug 26, 2013 8:40 AM, "scribbb" notifications@github.com wrote:

Yeah, This is the code I have too. But it's more like a simulation of the
actual progress right ?


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-23257112
.

@rstacruz
Copy link
Owner

I'm afraid there's no "official" way to find the actual progress in Pjax or Turbolinks as of right now.

You may experiment with a 3rd party library like jquery-ajax-progress.

@ghost
Copy link

ghost commented Mar 3, 2014

Try this.

$(document).pjax("a", '#pjax-container');
$(document).on('pjax:start', function() { NProgress.start(); });
$(document).on('pjax:end',   function() { NProgress.done();  });

@brickgale
Copy link

thanks @nzwsch 👍

@ghost
Copy link

ghost commented May 17, 2015

@nzwsch Lovely! Thank you.

@rstacruz
Copy link
Owner

seems like a reasonable addition to the readme.

@caarlos0
Copy link

@rstacruz or maybe just reference nprogress-rails, which already support turbolinks...

@eberkund
Copy link

Is there a way to make it so that the loading bar is not displayed when a user presses the back button?

@wirespecter
Copy link

wirespecter commented Apr 25, 2016

I have the same problem with @eberkund and I would also like to find a solution.
@caarlos0 Can you help?

@kwentworth
Copy link

You can use pjax:send instead of pjax:start

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants