AMP

重要事項:此文件不適用於您目前選取的格式 stories

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