如何停止js插件在页面加载时运行.我只想解决Ajax请求 [英] How to stop pace js plugin to run on page load. I want to fix only on Ajax request

查看:159
本文介绍了如何停止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

这篇关于如何停止js插件在页面加载时运行.我只想解决Ajax请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆