Important: this documentation is not applicable to your currently selected format email!




Transition an image's position and zoom between pages.


Required Scripts

<script async custom-element="amp-story-panning-media" src=""></script>

Supported Layouts

The amp-story-panning-media component provides a way to pan and zoom an image between pages in Web Stories.


Use the amp-story-panning-media to transition an image between pages. The component can animate between position and zoom.

Environment setup

Add the following script tag to the head of your Web Story:

<script async custom-element="amp-story-panning-media" src=""></script>


The amp-story-panning-media component accepts 1 descendant. This descendant must be an amp-img. Components transition between pages when their child has the same src value.

    <amp-story-panning-media layout="fill" x="-10%" y="-20%" zoom=".8">
      <amp-img layout="fill" src="assets/world-map.jpg" width="4000" height="3059" ></amp-img>

    <amp-story-panning-media layout="fill" x="20%" y="30%" zoom="2">
      <amp-img layout="fill" src="assets/world-map.jpg" width="4000" height="3059" ></amp-img>

Web Story use example

The Northern Sky Constellations Web Story uses a single star chart for the entire story. It highlights different constellations by panning and zooming. A parallax transition effect is also achieved by layering two png star images with transparency.

Web Story creation tool integration example

The Web Story creation tool integration example demos how to modify the component with sliders.


x (optional)

Specifies the horizontal position in percentage.
Centered on 0 (default) with positive values moving the image to the right (50% centering left edge of image) and negative to the left (-50% centering right edge of image).

y (optional)

Specifies the vertical position in percentage. Centered on 0 (default) with positive values moving the image down (50% centering top edge of image) and negative upward (-50% centering bottom edge of image).

zoom (optional)

Specifies the level of zoom. The default is 1. This corresponds to the image fitting the viewport with layout=fill. A higher value scales the image up (zooms in). A lower value scales the image down (zooms out).

lock-bounds (optional)

Prevents the image from panning beyond the viewport. When using lock-bounds width and height must be specified on the amp-img child.


This component is available in experimental. Validation details will be defined before launch.

Perlu bantuan lainnya?

Anda telah membaca dokumen ini belasan kali, tetapi belum semua pertanyaan Anda terjawab? Mungkin orang lain merasakan hal yang sama. Berinteraksilah dengan mereka di Stack Overflow.

Kunjungi Stack Overflow
Menemukan bug atau ada fitur yang kurang?

Proyek AMP sangat menganjurkan partisipasi dan kontribusi Anda! Kami berharap Anda akan terus ambil bagian dalam komunitas sumber terbuka kami, tetapi kami juga menerima kontribusi satu kali untuk topik tertentu yang Anda minati.

Kunjungi GitHub