CodeByZach / pace

Automatically add a progress bar to your site.
https://codebyzach.github.io/pace/
MIT License
15.68k stars 1.9k forks source link

allow manually starting stopping #129

Open pdeva opened 10 years ago

pdeva commented 10 years ago

i would like to be able to manually start/stop showing the loading animation on a div and manually pass in 'percentage'. it seems currently everything is only handled automagically

bloftd commented 10 years ago

Yap is posible use Pace.start() and Pace.stop() read pace documentation http://github.hubspot.com/pace/

ibarrajo commented 10 years ago

I did a Pace.stop() then I call the following function:

function jumpToAnchor(h) {
  // Save down the URL without hash.
  var url = location.href;
  // Go to the target element.
  location.href = '#'+h;
  // Don't like hashes. Changing it back.
  history.replaceState(null, null, url);
}

and it pace still runs. also tied ignoring, alas the same result.

Pace.ignore(jumpToAnchor, 'myanchor');

\ On pace 0.5.1 **

maeishoj commented 9 years ago

I try to call Pace.stop() after a 2-3 sec timeout so that the file Upload look more "real" (else it's so fast) but it seems like pace stops already by itself when the file is done uploading before hitting Pace.stop() :( any ideas?

Aknilam commented 9 years ago

For me Pace.stop() is not working. It doesn't hide progress bar immediately and still keeps to load next elements.

xavierartot commented 8 years ago

+1

moritz1234 commented 8 years ago

Lähetetty Honor-matkapuhelimestani-------- Alkuperäinen viesti --------Aihe: Re: [pace] allow manually starting stopping (#129)Lähettäjä: Xavier Artot Vastaanottaja: HubSpot/pace Kopio: +1

—Reply to this email directly or view it on GitHub.

vekexasia commented 8 years ago

In my case Doing a Pace.stop() + Pace.start() will show the loader. But it will automatically hide itself :(

ethaizone commented 8 years ago

I post this for who will looking to open it manual later.

Manual start.

Pace.stop();
Pace.bar.render();

For manual stop just use Pace.stop(); and if you want to revert it back, just stop then run Pace.start();

For me, I use this code for make page seemless when change page.

window.onbeforeunload = renderLoading;
function renderLoading()
{
    Pace.stop()
    Pace.bar.render();
}
PedroLV commented 7 years ago

My solution for running completely manual is chage a line of source code:

return animation = runAnimation(function (frameTime, enqueueNextFrame) { var avg, count, done, element, elements, i, j, remaining, scaler, scalerList, sum, _j, _k, _len1, _len2, _ref2; remaining = 100 - bar.progress; count = sum = 0; done = false; //change from true to false. So only stops on Pace.stop()

mathiasleroy commented 6 years ago

+1
Need to prevent pace from automatically starting at the beginning.
Pace.stop() still allows pace to run a few milliseconds.

alperozaydin commented 5 years ago

I had to force the progress bar to track my ajax call.

Pace.track(function(){
  $.ajax(...)
});

Make sure async: true in ajax call.