Suite | Growth, Professional, Enterprise, or Enterprise Plus |
Support with | Guide, any plan |
使用 Guide V2 模板化版本时,如果您想在主题中使用 jQuery 语句而非普通的 JavaScript,则需要导入 jQuery 库。
本指南仅供说明之用,如果您有任何 jQuery 问题,请参阅官方 jQuery 网站。
在帮助中心主题中安装或升级 jQuery
- 在知识管理中,单击侧栏中的自定义设计 (
)。
- 在要使用的主题上单击自定义。
- 单击编辑代码。
- 单击 document_head.hbs。
- 访问 https://code.jquery.com,然后单击您要使用的 jQuery 版本的缩小版本。
- 粘贴
script
标签到您的 HTML 文件中。例如:<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"> </script>
integrity
值会有所不同。浏览器可通过此属性得知第三方服务器上托管的资源未被篡改。
jQuery 库随即加载,您可以在帮助中心主题中包含 jQuery 语句。
2 条评论
Christopher Kennedy
Hi Bradley,
You can use the version of jQuery that you'd like in your theme. That portion is totally within your control. Also, this article demonstrates loading jQuery from the document_head.hbs template. This template renders on all Help Center pages, so no need to duplicate that effort elsewhere.
Thanks,
0
Brad Allen
Two questions related to this.
1 - what version of jquery must be installed to use this code?
2 - does this just need to be added to the script.js file in templates or do i need some HTML in my new requests template as well?
0
登录再写评论。