webtuts4u webtuts4u - 7 months ago 60
Javascript Question

How to stop pace js plugin to run on page load. I want to fix only on Ajax request

I'm using jquery pace plugin with progress bar theme, all is working good. but i want to fix this run only on ajax request. After lots of searching i'm deciding to post there. Hope someone having the solution. Currently its running on both Ajax and page load.

Here's the js file call with options given by plugin. but no luck.

<script data-pace-options='{ "document": false }' src="js/pace/pace.min.js"></script>


I found the answer to stop pace.js on page load and here I'm posting this for other users.

Here's the code of js calling.

<script data-pace-options='{ "elements": { "selectors": [".selector"] }, "startOnPageLoad": false }' src="js/pace/pace.min.js"></script>

In this i'm setting pace to given selector and another option startOnPageLoad set to false to avoid loading pace on every page load.

And here is the another question on pace.js which provide me a help.

Using pace.js on loading appended images