AMP
  • 网站

amp-fx-flying-carpet

简介

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

设置

在标头中导入 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 参数指定飞毯“窗口”的高度。

广告
广告
<div class="amp-flying-carpet-text-border">Advertising</div>
<amp-fx-flying-carpet height="300px">
  <amp-ad width="300" height="600" layout="fixed" type="doubleclick" data-slot="/35096353/amptesting/formats/flying_carpet">
  </amp-ad>
</amp-fx-flying-carpet>
<div class="amp-flying-carpet-text-border">Advertising</div>

用于图像的飞毯

amp-fx-flying-carpet 也可用于显示图像。

<amp-fx-flying-carpet height="300px">
  <amp-img src="/static/samples//img/landscape_lake_1280x857.jpg" width="1280" height="853" alt="an image">
  </amp-img>
</amp-fx-flying-carpet>

定位

amp-fx-flying-carpet 元素必须放置在最后一个视口之前,因此请确保在元素之后放置足够的内容以覆盖目标视口大小。

下面的框是为了确保 amp-fx-flying-carpet 放置在最后一个视口之前。

需要进一步解释?

如果此页面上的解释没有涵盖您的所有问题,请随时与其他 AMP 用户联系,讨论您的确切用例。

前往 Stack Overflow
未解释的功能?

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

在 GitHub 上编辑示例