如何在AMP上实现Jquery?

如何在AMP上实现Jquery?,jquery,amp-html,Jquery,Amp Html,我尝试在AMP页面上使用JQuery 例如,我已经满足了amp要求,比如脚本/HTMLAMP等 这里有一个例子: const-button=document.getElementById('hello-url'); 按钮。addEventListener('单击',()=>{ console.log('clicked'); 常量h1=document.createElement('h1'); h1.textContent='helloworld!'; 文件.正文.附件(h1); }); 你好

我尝试在AMP页面上使用JQuery

例如,我已经满足了amp要求,比如脚本/HTMLAMP等

这里有一个例子:

const-button=document.getElementById('hello-url');
按钮。addEventListener('单击',()=>{
console.log('clicked');
常量h1=document.createElement('h1');
h1.textContent='helloworld!';
文件.正文.附件(h1);
});

你好,AMPs
{
“@context”:”http://schema.org",
“@type”:“新闻文章”,
“标题”:“发布内容的开源框架”,
“发布日期”:“2015-10-07T12:02:41Z”,
“图像”:[
“logo.png”
]
}
body{-webkit动画:-amp start 8s steps(1,end)0s1 normal tweet;-moz动画:-amp start 8s steps(1,end)0s1 normal tweet;-ms动画:-amp start 8s steps(1,end)0s1 normal tweet}@-webkit关键帧-amp start{从{可见性:隐藏}到{可见性:可见}}@-moz关键帧-amp start{from{可见性:隐藏}
打招呼

像jQuery这样的外部Java脚本在AMP中。除了or之外。

简短回答-你不能。原因:jQuery太大,加载时间太长。AMP设置大小和运行时限制。如果你决定不重写目标jQuery函数,你将不得不删减jQuery并将删减后的代码与目标代码集成。你可以检查AMP的“Actions and events”用于单击事件操作。如果您有jQuery所需的页面部分,则可以将该部分作为带有AMP iframe的AMP中的iframe加载。在该iframe中,您可以加载任何外部脚本。