Skip to content
animorio
IT
Back to the library

Product card hover

Hover, ImagesGSAP, CSS onlyMediumCompressed weight: Demo 7.1 KBGSAP 28 KBFreeDownload the zip

The product card of Aldern Goods, a made-up leather shop, on light paper: a leather satchel with two real photos. On hover the card lifts, the second photo wipes in over the first, and a glass tray rises from the bottom with the laptop sizes and Add to cart. With no size picked the tray shakes its head and the button asks for one; with a size the button closes into a circle with a spinning ring, the thumbnail flies in an arc to the bag at the top and the number rolls.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Product card hover" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Product card hover</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <!-- The product card of Aldern Goods, a made-up leather shop: on hover the second photo wipes in over the first,
       the laptop sizes and Add to cart rise from the bottom of the photo, and the bag flies into the cart -->
  <main class="stage" data-stage>
    <header class="shop" data-shop>
      <p class="shop__name">Aldern <span>Goods</span></p>
      <button class="bag" type="button" data-bag aria-label="Bag, 0 items">
        <span class="bag__icon" data-bag-icon>
          <svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true">
            <path d="M5.2 8.5h13.6l-1 11.2a1.6 1.6 0 0 1-1.6 1.5H7.8a1.6 1.6 0 0 1-1.6-1.5z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/>
            <path d="M9 10.5V7a3 3 0 0 1 6 0v3.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>
          </svg>
        </span>
        <span class="bag__label">Bag</span>
        <span class="bag__count" data-count aria-hidden="true">
          <span class="bag__digits" data-digits><span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span></span>
        </span>
      </button>
    </header>

    <article class="card" data-card tabindex="0" aria-label="Mercer Satchel, full-grain leather, 248 dollars">
      <div class="card__lift" data-lift>
        <div class="card__media" data-media>
          <div class="photo photo--a" data-photo-a>
            <img src="indossata.webp" width="960" height="613" alt="The tan leather satchel on a bench beside someone typing on a laptop" data-img-a>
          </div>
          <div class="photo photo--b" data-photo-b>
            <img src="cartella.webp" width="1024" height="654" alt="The same tan satchel carried by its strap" data-img-b>
          </div>
          <span class="tag" data-tag>New</span>

          <div class="tray" data-tray>
            <div class="sizes" data-sizes role="radiogroup" aria-label="Laptop size">
              <span class="sizes__pill" data-pill aria-hidden="true"></span>
              <button class="size" type="button" role="radio" aria-checked="false" data-size>13″</button>
              <button class="size" type="button" role="radio" aria-checked="false" data-size>14″</button>
              <button class="size" type="button" role="radio" aria-checked="false" data-size>16″</button>
            </div>
            <button class="add" type="button" data-add>
              <span class="add__face add__face--idle" data-face-idle>Add to cart</span>
              <span class="add__face add__face--hint" data-face-hint>Pick a size</span>
              <span class="add__face add__face--done" data-face-done>
                <svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path data-check d="M3.2 8.4l3 3 6.6-6.8" pathLength="1" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>
                Added
              </span>
              <span class="add__face add__face--ring" data-face-ring aria-hidden="true">
                <svg class="ring" data-ring viewBox="0 0 20 20" width="18" height="18"><circle cx="10" cy="10" r="7.5" fill="none" stroke="currentColor" stroke-opacity=".25" stroke-width="2"/><path d="M10 2.5a7.5 7.5 0 0 1 7.5 7.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
              </span>
            </button>
          </div>
        </div>

        <div class="card__info">
          <div class="card__row">
            <h1 class="card__title" data-title>Mercer Satchel</h1>
            <p class="card__price" data-price>$248</p>
          </div>
          <div class="card__row card__row--sub">
            <p class="card__sub">Full-grain leather</p>
            <p class="swatches" aria-label="3 colours, Tan selected">
              <span class="swatch swatch--on" style="--c:#c27a44"></span>
              <span class="swatch" style="--c:#2b2622"></span>
              <span class="swatch" style="--c:#6f6a45"></span>
            </p>
          </div>
        </div>
      </div>
    </article>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

42 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Product card hover” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

At the top the shop name, Aldern Goods, and on the right the Bag pill with the bag icon. In the middle the white card with the photo of the tan leather satchel, the glass New tag, and below Mercer Satchel, $248, Full-grain leather and three colour dots, with tan ringed. On hover the card lifts by six pixels with the shadow stretching, the first photo moves closer and slides a little, and the second photo, the same satchel carried by hand, wipes in from the right; from the bottom of the photo a frosted glass tray rises with the laptop sizes, 13″, 14″ and 16″, and the black Add to cart button, one after the other. Pressing Add to cart with no size makes the tray shake its head and the button says Pick a size; once a size is picked, the black pill slides under it on a spring and the button goes back to Add to cart. Pressed, the button sinks, closes into a circle with the ring spinning in the middle, a thumbnail of the satchel leaves the photo and flies in an arc to the bag at the top, which bounces, while the orange count pops out and the number rolls; then the button opens again with the checkmark drawing itself and Added, and goes back to Add to cart. On leaving, the second photo exits to the left and the tray drops.

How it works

Two photos stacked

The two photos share the same 4:5 frame, one on top of the other. The second has clip-path: inset(0 0 0 100%) and comes in by taking the left side to 0, while the first moves closer by 1.05 and slides by 3%; on leaving the wipe closes to the left and then resets to the right unseen.

The rising tray

The glass tray (backdrop-filter) sits inside the photo, at the bottom, pushed out with yPercent 100; it rises with a light back.out and its two rows arrive 0.07 seconds apart.

The size

An absolute black pill behind the three sizes takes its position and width from the picked button (offsetLeft and offsetWidth) and slides there on a spring; it is measured again on resize.

The closing button

The four faces of the button (Add to cart, Pick a size, Added, the ring) are absolute with inset 0 and centred: as the button narrows into a circle no label can widen it and the ring stays in the middle. The ring is an svg turning with transformOrigin 50% 50%.

The flight

A copy of the photo in a 46-pixel square leaves the centre of the photo and follows a quadratic Bézier curve to the bag icon, with the control point ARC pixels above both; it shrinks and tilts a little halfway. On arrival the bag bounces with keyframes and the number rolls: it is a column of ten digits moved by −10% per item.

Values to change

NameFileDefaultWhat it changes
SPEEDscript.js1The speed of everything.
WIPEscript.js0.85Seconds of the wipe between the two photos.
LIFTscript.js6How many pixels the card lifts on hover.
ZOOMscript.js1.05How much the first photo moves closer while the second passes.
FLYscript.js0.95Seconds of the thumbnail’s flight to the bag.
ARCscript.js90How many pixels the flight’s arc rises.
SPINscript.js0.75Seconds of the ring in the button before Added.
PRODUCTscript.js"Mercer Satchel"The product name.
PRICEscript.js"$248"The price.

Try them in the Playground

When to use it

In the product grid of an online shop, on a category page or among the recommendations: the card shows the second photo, the size and adding to cart without opening the product page.

On phones

Phones have no hover: a tap on the card opens it and another closes it, and the tray stays tappable. The card is sized on the height too (calc on 100vh), so photo, name and price fit in the box.

With reduced motion

No movement: the second photo and the tray fade in, the card does not lift, there is no flight and the button fades from Add to cart to Added while the number changes.

Pitfalls

  • The button faces must be absolute: a hidden nowrap label in the flow keeps the button wide and the ring ends up outside the circle.
  • The button width is measured before narrowing it and cleared (clearProps) at the end, otherwise on resize it keeps the old one.
  • The tray lives inside the photo, which has overflow hidden: pushed by yPercent 100 plus 30 pixels not even its shadow shows.
  • The size :hover sits inside @media (hover: hover), otherwise on phones it stays on after a tap.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 7.1 KB; the libraries: GSAP 28 KB.

Testing

Tested on 2 December 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations