AMP

amp-fx-flying-carpet

描述

将其子元素包装在一个独特的全屏滚动容器中,允许您显示全屏广告而无需占用整个视口。

 

必需脚本

<script async custom-element="amp-fx-flying-carpet" src="https://cdn.ampproject.org/v0/amp-fx-flying-carpet-0.1.js"></script>

用法

amp-fx-flying-carpet 在固定高度的容器内显示其子元素。当用户滚动页面时,飞行地毯会显示更多内容,并在其子元素上滑动,就像透过页面上的窗口窥视一样。

在实现 amp-fx-flying-carpet 以显示广告时,请检查您的广告网络是否允许使用飞行地毯。

<amp-fx-flying-carpet height="300px">
  <amp-img
    src="fullscreen.png"
    width="300"
    height="500"
    layout="responsive"
  ></amp-img>
</amp-fx-flying-carpet>

以下要求适用于 amp-fx-flying-carpet 定位

  • 它应该定位在不妨碍第一个视口的位置(在顶部 75% 之外)。
  • 它应该定位在滚动时其顶部可以到达或高于最后一个视口顶部的位置。

属性

高度

飞行地毯“窗口”的高度。

通用属性

amp-fx-flying-carpet 包括扩展到 AMP 组件的通用属性

样式

您可以使用 amp-fx-flying-carpet 元素选择器自由地设置其样式。 amp-fx-flying-carpet 元素的 position 始终为 relative

验证

请参阅 AMP 验证器规范中的amp-fx-flying-carpet 规则

需要更多帮助?

您已经阅读本文档十几次了,但它并没有真正涵盖您的所有问题?也许其他人也有同样的感觉:在 Stack Overflow 上联系他们。

转到 Stack Overflow
发现错误或缺少功能?

AMP 项目强烈鼓励您的参与和贡献!我们希望您将成为我们开源社区的长期参与者,但也欢迎您为自己特别关注的问题做出一次性贡献。

转到 GitHub