184

Fullscreen Flip Gallery

£7
or the whole Vault, £99
Open in new tab

A full-bleed photo gallery that turns like a flip calendar: each photograph is hinged across its middle, and dragging, scrolling or the arrow keys fold the top half down to reveal the next photo, and a hard scroll or flick turns a few photos in quick succession, one clean flip after another.

advanced
9 more details
3d-transformssplit-flapdragtouch-dragmomentumspring-physicskeyboard-navigationreduced-motionprogressive-enhancement

Released

About this effect

Your photographs fill the whole screen, edge to edge, with nothing around them but a small count in one corner and a one-line caption in the other. Each photo is hinged across its horizontal middle like the leaf of a flip calendar or a departure board.

Read the full effect overview

Turning to the next photo folds the top half down over the bottom half. The back of the falling leaf already carries the bottom half of the next photograph, and its top half is uncovered behind it, so the new picture assembles itself as the leaf lands. Going back folds the bottom half up again. Each leaf darkens as it turns away from the light and casts a soft shadow on the half beneath it, and it lands with a slight overshoot before it rests.

Drag up or down and the leaf follows your hand; let go and it springs to the nearer side. A scroll wheel or the arrow keys turn one photo at a time. Scroll or flick hard and a few photos turn in quick succession, each leaf finishing its fall before the next is far behind, and it settles on a single photo. At the first and last photo the scroll wheel is handed back to the page, so visitors scroll on past the gallery.

Fullscreen Flip Gallery - GSAP animation effect preview

What's included

13 items
  • Full-bleed photographs, edge to edge, with only a small count, a one-line caption and quiet previous and next buttons over them
  • Each photo is hinged across its middle: the top half folds down to reveal the next photo, and the bottom half folds up to go back
  • The back of each falling leaf carries the bottom half of the next photo, so the picture completes itself as the leaf lands
  • Leaves shade as they turn and cast a soft shadow on the half beneath, with a fine crease line at the fold
  • Vertical drag with the mouse or a finger holds the leaf at any angle and springs it to the nearer side on release
  • A hard scroll or flick turns a few photos in quick succession at a steady pace, then settles on one photo with a slight overshoot
  • Scroll wheel turns the photos while the pointer is over the gallery and hands scrolling back to the page at the first and last photo
  • Arrow keys, Page Up and Page Down, Home and End, plus native previous and next buttons with visible focus
  • Small placeholders load for every photo; full-size files load only around the current one, current photo first, a few at a time, with retries
  • Only the leaves in motion are drawn, from a small reused pool, so a run of flips costs the same however long the gallery is
  • Reduced motion swaps photos with a plain crossfade and keeps every control; without JavaScript the photos show as a simple captioned list
  • Start photo, wheel handling, fold duration, the most leaves in the air and the cue text all set from data attributes
  • Small API (goTo, next, prev, refresh, revert) and an fsflip:change event; several galleries on a page stay independent

Perfect for

4 use cases
  • Landscape, travel and architecture photography portfolios that want each picture to fill the screen
  • Photo essays and story pages where readers turn through a sequence one full-screen frame at a time
  • Hotel, venue and estate sites showing their grounds and views without thumbnails or frames
  • Project and case-study pages that open with a full-bleed run of photographs before the copy

How it works

2 sections

The gallery is an ordered list of figures: each holds the full-size photograph, a small placeholder file named on a data attribute, and a caption. Without JavaScript that list is the gallery, shown as a stack of captioned photos.

With JavaScript the photos are drawn as two halves of a full-screen stage, split at the middle. One number, the position in the gallery, decides how far each leaf should have turned. Dragging moves that number directly, and GSAP eases it after a flick, a scroll step or a key press. Each leaf follows its own target like a light spring, so when several photos turn the leaves follow one another at a steady pace, and a long jump cuts ahead and turns only the last few. Only the leaves in motion are drawn, from a small pool of reused elements, and each is shaded from its angle. Under reduced motion the same controls crossfade between photos instead. Everything the script adds, from the leaves and controls to its listeners, is removed again on revert().

Difficulty Advanced
Includes HTML + JS + CSS source, documentation, AI setup prompt, lifetime updates

Lighthouse, as measured

Google Lighthouse on this effect's demo, from the latest scan. A measurement of the demo as shipped, not a promise for your page.

Accessibility
100
Best practices
100

No performance score, on purpose. That figure depends on how you deploy: your server's compression and caching, your CDN, the connection and the device doing the test, none of which the code controls. The same page can score very differently on two consecutive runs, so measure it where it will live.

The Vault opens this source and the whole library.

Each product gives you the HTML, CSS and JavaScript source, the full documentation and an AI setup prompt, licensed for unlimited personal and commercial projects. Every paid product is tested for desktop and mobile layouts, reduced-motion handling, animation cleanup and keyboard controls wherever there is something to operate.

One payment, over 350 products, and future additions to the library.

Documentation

Quick Start

1. Add to your HTML <head>:

In your downloadThe working code for this step, in index.html.

2. Add before the closing </body> tag:

In your downloadThe working code for this step, in index.html.

3. Add the gallery anywhere in your <body>:

In your downloadThe working code for this step, in index.html.

Each item holds the full-size photograph (about 1600 to 1920 px wide), a small placeholder of the same photo on data-fs-flip-small (about 480 px wide) and a caption. Without JavaScript this list is the gallery, shown as a column of captioned photos.

Using It With Your Own Design

What the effect needs from your markup:

  • A wrapper with data-fs-flip, holding a data-fs-flip-stage element and a data-fs-flip-list list. The stage is where the photos are drawn and where drags and the scroll wheel are taken.
  • Each .fs-flip__item holds one <img>. Its src is the full-size file and data-fs-flip-small the placeholder; without the attribute the full-size file is used for both. The caption comes from the <figcaption> (or .fs-flip__caption), falling back to the alt text.
  • data-focus on an item is the part of the photo kept in view when the gallery is narrower than the photo, such as a portrait phone. It takes any object-position value; the default is 50% 50%.
  • The .fs-flip__poster image is optional. When it is the same file as the opening photo it stays up until that photo has loaded at full size, so the first paint is the real photo.
  • The script adds the folding layers inside the stage, and the count, caption, previous and next buttons and the cue to the wrapper. It also loads every photo itself, so the list's own images are never requested while the gallery is live.

What is only the demo's styling: the demo page block at the top of style.css, the Inter font, the ground colour and the type sizes. Colours, gutter, font and height are custom properties on .fs-flip (--fs-flip-ground, --fs-flip-ink, --fs-flip-gutter, --fs-flip-font, --fs-flip-height). The no-JavaScript column is plain CSS grid and can be restyled freely.

CSS the effect depends on:

  • The .has-js .fs-flip:not([data-fs-flip-off]) block. It gives the gallery its height, hides the list and shows the stage. .has-js is added in the head, before the stylesheet, so the list never flashes first.
  • .fs-flip__half, .fs-flip__leaf and .fs-flip__face: each half is a clipped window onto a photo as tall as the whole stage, and each leaf turns about its lower edge with transform-style: preserve-3d and a hidden back face. Keep these rules as they are.
  • isolation: isolate on .fs-flip__view, so the leaves stack among themselves and never over the count and caption.
  • touch-action: pan-x pinch-zoom on the stage, so a vertical finger drag turns the photos instead of scrolling the page. On a phone, leave some page above or below a full-height gallery, or give it a shorter --fs-flip-height, so visitors have somewhere to scroll the page from.
  • The bottom and top scrims (.fs-flip__chrome and .fs-flip__cue backgrounds) keep white text above 4.5:1 on bright photographs. If you remove them, check your captions on your lightest photo.

Options

Set these on the data-fs-flip wrapper.

Attribute Values Default Description
data-start 0 to the last index 0 Photo the gallery opens on, counting from 0
data-wheel on, off on off leaves the scroll wheel to the page entirely; drag, keys and buttons still turn the photos
data-duration 0.3 to 2.5 0.7 Seconds for one leaf to fall and settle. Shorter is snappier
data-max-leaves 1 to 12 6 Most leaves drawn in the air at once. A run of flips is paced so that only two or three are, so the default rarely needs changing
data-cue Any text, or empty Scroll or drag to flip Cue shown in the top corner on pointer devices until the first interaction. Empty on both cue attributes removes the cue
data-cue-touch Any text, or empty Drag to flip The same cue on touch screens

On .fs-flip__item:

Attribute Values Default Description
data-focus Any object-position 50% 50% Part of the photo kept in view on narrow screens

How it takes input

  • Drag up or down anywhere on the photo with a mouse or a finger. The leaf follows the hand and springs to the nearer side when you let go; a quick flick turns up to three more photos in quick succession.
  • Scroll wheel and trackpad turn the photos while the pointer is over the gallery and the gallery is in view. A gentle scroll turns one photo. A hard spin or swipe turns photos one after another at about three a second, never queues more than three ahead, and stops soon after you do. At the first and last photo the wheel is not taken, so the page scrolls on, and the rest of that gesture stays with the page, including its momentum and an immediate change of direction. A scroll that started elsewhere on the page and glides across the gallery keeps scrolling the page.
  • Keys (with the gallery focused): Arrow Down, Arrow Right and Page Down go forward; Arrow Up, Arrow Left and Page Up go back; Home and End jump to the first and last photo: the gallery cuts to three photos short and turns the rest.
  • Buttons: the quiet previous and next buttons beside the count.

The gallery does not loop. It works inside an iframe too: at both ends the wheel is left uncancelled, so a parent page that forwards wheel input continues scrolling.

Accessibility

  • Keyboard: the stage is focusable, with a visible focus ring, and takes the arrow keys, Page Up, Page Down, Home and End. The previous and next buttons are native <button> elements with labels and a visible focus ring; at the ends they are marked aria-disabled but keep focus.
  • Screen readers: the stage is a labelled group. After each turn settles, a polite live region announces the position, caption and alt text ("Photo 4 of 25. Road along the fjord, Iceland. ..."). The drawn layers are hidden from assistive technology.
  • Reduced motion: with prefers-reduced-motion: reduce there is no fold. Photos change with a short crossfade, and drag (a swipe of 40 px or more), the wheel (one photo per gesture), keys and buttons all still work. Changing the preference while the page is open rebuilds the gallery in place.
  • No JavaScript, or GSAP failing to load: the list shows as a column of captioned photographs.
  • Contrast: the count, caption and cue are white over soft dark scrims, measured above 4.5:1 on the demo's brightest photographs.

Photographs

The demo's 25 photographs of Iceland, the Faroe Islands and the Scottish Highlands are resized, lightly graded WebP derivatives of photos from Pexels, used under the Pexels licence. assets/img-manifest.json lists each source URL and output file. Full-size files are 1440 to 1920 px wide and placeholders 480 px wide. Replace the files with your own, or edit the manifest and rebake them.

Performance

  • Only the leaves in motion are drawn, from a reused pool of data-max-leaves elements, so a run of flips costs the same in a gallery of 10 photos or 200.
  • Leaves move with transform and their shading with opacity; images are swapped only when a leaf starts carrying a different photo.
  • Placeholders load for every photo, nearest first. Full-size files load only within two photos of the current one and of where a run of flips is heading, current photo first, three requests at a time, with retries, so a leaf never shows blank.
  • The animation clock stops completely when nothing is moving.

Dependencies

Required:

  • GSAP 3.12+ (the demo is built against 3.15.0). Core only, no plugins.

Not used: ScrollTrigger and Lenis. The gallery takes its own input, and does not need page scrolling, so it sits happily on a page that runs either.

Also in your download: the full source, worked examples, the events and programmatic API, and the class reference.

£7