【发布时间】:2019-09-15 19:14:32
【问题描述】:
AMP 文档提到使用带有 amp-script 组件的 jQuery:https://amp.dev/documentation/guides-and-tutorials/develop/custom-javascript/
但是,我没有看到任何示例,也没有说明如何执行此操作。
我尝试在下面的示例 AMP 页面(分别为 3.4.1 和 2.2.4)中包含 jQuery,并运行这个简单的 jQuery 脚本:
$('button').click(function() {
$('body').append('hello world');
})
AMP 网页示例:
https://apps.yourstorewizards.com/sandbox/amp/amp-script/jquery3.html https://apps.yourstorewizards.com/sandbox/amp/amp-script/jquery2.html
两者都没有按预期工作。两者都会产生 javascript 错误。在 AMP 中可以使用哪些 jQuery 函数有限制吗?
任何帮助将不胜感激。谢谢。
【问题讨论】:
-
您好,欢迎来到 StackOverflow。请花一些时间阅读帮助页面,尤其是名为"What topics can I ask about here?" 和"What types of questions should I avoid asking?" 的部分。此外,请阅读Stack Overflow question checklist。还可以了解如何发帖Minimal, Complete, and Verifiable Examples。
-
@JayGray 感谢您的建议,我已经更新了我的问题。