如何停止js插件在页面加载时运行.我只想解决Ajax请求

如何停止js插件在页面加载时运行.我只想解决Ajax请求

问题描述:

我正在使用带有进度条主题的 jquery步速插件,一切正常.但我想修复此运行只在ajax请求.经过大量搜索后,我决定在此发布.希望有人有解决方案.目前,它既可以在Ajax上运行,也可以在页面加载上运行.

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.

这是js文件调用,其中包含插件提供的选项.但没有运气.

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.

这是js调用的代码.

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

在这种情况下,我将速度设置为给定的选择器,而另一个选项startOnPageLoad设置为false,以避免在每次页面加载时加载速度.

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

这是关于speed.js的另一个问题,为我提供了帮助.

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

在加载附加图像时使用speed.js