Milo

Hover a card, change what’s inside

  • Motion
  • 4 min 3 s

Point at a card and change the things inside it. Give the arrow and the photo inside a card their own variants, then add While Hovering behaviors on the card that switch them with Change to, on the Clauseway template.

Steps

  1. Open the Clauseway template if you’d like to follow along.
  2. The cards already lift a little on hover, but nothing inside them changes yet.
  3. Each thing that changes needs a variant first: a second look the element can switch to.
  4. Select the arrow, open Styles and click Add variant, so the whole card can switch it. Name it, then set Rotation in the edit panel.
  5. Same steps for the photo. In the edit panel, Add overlay lays a shade over it, and its Brightness sets how strong it is.
  6. Select the card, open Behaviors, add a new behavior, pick While Hovering and Do an action.
  7. Navigate to, Scroll to, Open link, Open overlay and Close overlay. Change to switches an element, or something inside it, to one of its variants.
  8. Target is what changes: Self, or something inside the card. Pick on canvas outlines everything you can choose, so you can click it.
  9. Default is how it normally looks. Pick the variant you made.
  10. Revert puts it back when the pointer leaves. Hold keeps it changed.
  11. Instant swaps it straight away. Animate changes it smoothly, using Easing and Duration.
  12. Add a second behavior for the photo, with its Darker variant.
  13. Point at the card: it lifts, the arrow turns and the photo darkens. Move away and it all goes back.
Read the full transcript

In the last video, we gave a card a new look while the pointer was over it. This time, pointing at a card will change things inside it. I'm on Clauseway, a template for a contract review tool, and we'll work with these contract cards.

Here they are in Preview. When I point at one, it lifts a little. That's a hover effect the template already has. Nothing inside the card changes yet, so let's go back and add that.

Two things will change. This arrow will turn to point right, and the photo will get darker. Each one needs a variant first, which is a second look that the element can switch to.

I'll select the arrow and open Styles. Add hover variant would only kick in when the pointer is on the arrow itself, and I want the whole card to set it off. So I'll click Add variant instead. That makes a variant that a behavior can switch to.

I'll name it Pointing. Now I'll select the new variant and open the edit panel. Down in Transform, I'll set Rotation to forty-five degrees. There, the arrow points right.

Now the photo. I'll go back, select it, and do the same thing: Styles, then Add variant. I'll call this one Darker.

Then I'll select it and open the edit panel, on the Design tab. I'll click Add overlay. That lays a soft shade over the photo, darkest at the bottom, where the words sit. It's a little faint, so I'll turn its Brightness up to ninety percent. Now you can really see it.

Next, the card itself, because that's what the pointer moves over. I'll select it, open Behaviors, and add a new behavior with the plus button. For the trigger, I'll pick While hovering. And instead of Apply an effect, which we used in the last video, I'll choose Do an action.

Here are the actions. Navigate to opens another page of your site. Scroll to moves the visitor to a spot on this page. Open link goes to a web address. And Open overlay and Close overlay show and hide a pop-up.

Change to is the one we want. It can switch the element you've selected to one of its variants, or switch something else, like the arrow inside this card, to one of its variants.

Target is the element that changes. Self means the card itself. Below it are the things inside the card that have variants of their own, like this image.

There's also Pick on canvas. When I click it, everything I can choose gets a dotted outline, and I just click the one I want. That's handy when the list is long, or when you're not sure which name goes with which element. I'll click the arrow.

Next is Variant, which lists the arrow's variants. Default is how it normally looks, and Pointing is the one we just made, turned forty-five degrees. I'll pick Pointing.

On exit decides what happens when the pointer leaves the card. Revert puts the arrow back the way it was, which is what you'll want for most hover effects. Hold keeps it turned, even after the pointer moves away. That's useful when something should stay changed once a visitor has noticed it. For this card, I'll switch back to Revert.

Animation mode is set to Instant, which swaps it straight away. Animate turns it smoothly instead. Easing is how it speeds up and slows down, and Duration is how long it takes. I'll pick Animate, and this small Preview button plays it on a sample, so I can check it without leaving the panel.

Now the photo needs a behavior of its own. I'll add another new behavior with the plus. While hovering, Do an action, and Change to is already picked. This time I'll choose Image straight from the Target list, then the Darker variant, and Animate.

Let's try it. I'll click Preview and point at the first card. It lifts, the arrow turns, and the photo gets darker. When I move away, it all goes back. Each card has its own behaviors, so for the same effect on the others, repeat these steps on each one.

That's it for this one. Now when someone moves across these cards, each one reacts, which makes it easy to see they can be clicked. Give it a try on a few cards of your own.

Build something that moves people.

Tell Milo what it’s for and see your site take shape in minutes.

Free to start. No card needed.