Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 709
CodeBriefly Avatar asked Sep 26 '14 10:09

CodeBriefly


1 Answers

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

like image 172
CodeBriefly Avatar answered Nov 07 '22 10:11

CodeBriefly