AMP HTML - 在 AMP 中持续关闭横幅?
AMP HTML - persistent dismissal of banner in AMP?
我在 hugo 应用程序中使用 gohugo-amp 主题。在页眉中,我有一个横幅,我想关闭 onclick 并存储关闭状态。
我已经尝试 <a class="page-banner__close" on="tap:page-banner.hide">X</a>
但是刷新页面时横幅 returns。
我也尝试过使用 <amp-user-notification>
标签。但是 <amp-user-notification>
修复了页脚中的横幅。
有没有办法在页眉中放置可关闭的横幅并存储已关闭的状态,这样刷新时它就不会 return??
您可以将 amp-user-notifcation
组件的样式添加到您的 CSS:
以放置在顶部
amp-user-notification {
top: 0;
bottom: inherit;
}
我在 hugo 应用程序中使用 gohugo-amp 主题。在页眉中,我有一个横幅,我想关闭 onclick 并存储关闭状态。
我已经尝试 <a class="page-banner__close" on="tap:page-banner.hide">X</a>
但是刷新页面时横幅 returns。
我也尝试过使用 <amp-user-notification>
标签。但是 <amp-user-notification>
修复了页脚中的横幅。
有没有办法在页眉中放置可关闭的横幅并存储已关闭的状态,这样刷新时它就不会 return??
您可以将 amp-user-notifcation
组件的样式添加到您的 CSS:
amp-user-notification {
top: 0;
bottom: inherit;
}