PACE JS - Page Load Only

1

I'm using this plugin, Page.JS - link - to make a progress bar on the site.

I'm calling it like this:

<script src='js/vendor/pace.min.js' data-pace-options='{ "elements": false, "startOnPageLoad": true, "restartOnRequestAfter": false }'></script>

It is partially working. When I enter the page loads the progress bar.

The problem is that this is happening on every request. As it is a Single Page my site, I have a script that when scrolling the screen goes changing the URL. For example, I have a MENU like this:

Home Contact
Products

And when you scroll for a particular session, you're doing localhost/pagina#home , localhost/pagina#contato and so it goes.

And when I scroll the page, the progress bar appears.

I'm not understanding how this plugin works.

    
asked by anonymous 03.09.2015 / 13:52

2 answers

2

By default , this plugin adds the progress bar for all jQuery events, if you need only in the page load event, you can keep "startOnPageLoad": true and add "ajax": false to avoid displaying to each request. Staying like this:

<script src='js/vendor/pace.min.js' data-pace-options='{ "elements": false, "startOnPageLoad": true, "ajax": false, "restartOnRequestAfter": false }'></script>
    
03.09.2015 / 14:05
1

You can try to add ignoreURLs to options:

Pace.options = {
  ajax: {
    ignoreURLs: ['some-substring', /some-regexp/]
  }
}
    
03.09.2015 / 14:01