简体   繁体   English

我可以排除在页面上使用 javascript 文件吗?

[英]Can I exclude a javascript file from being used on a page?

I am using jQuery Qtip 1 and Qtip 2 plugin scripts.我正在使用 jQuery Qtip 1 和 Qtip 2 插件脚本。 I have to have them both linked on my homepage, but of course it gives errors because I am linking to both of them on the Homepage.我必须将它们都链接到我的主页上,但它当然会出错,因为我在主页上链接到它们。 Is there a way to exclude Qtip 1 from JUST one page, or simply tell the page to only use this particular javascript instead of the other;有没有办法从一个页面中排除 Qtip 1,或者只是告诉页面只使用这个特定的 javascript 而不是另一个; perhaps I have to use jQuery?也许我必须使用 jQuery?

Also, 80% of my pages are using Qtip 1, and only the homepage is using Qtip 2.另外,我 80% 的页面使用的是 Qtip 1,只有主页使用的是 Qtip 2。

I am using Template pages.我正在使用模板页面。

You can add a class name to the <body> element in each page, then write if ($('body').hasClass('something')) .您可以在每个页面的<body>元素中添加一个 class 名称,然后编写if ($('body').hasClass('something'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM