Keep an eye on your inbox!
Hmm, that didn't work. Try again?

How to show and hide content with Webflow click interactions

Find out how to use click interactions to affect other elements on the page.

Mat Vogels
November 3, 2015
Tutorials

If you've ever wanted to have a panel slide on to the screen after someone clicks a button, we've got you covered.

Showing and hiding an element on click is a very common interaction, and one that we showcase on our Interactions page

So how did we do it? We’ll show you. Just follow these steps, and check out the live version in your Webflow account. 

Step 1: Add the elements of the interaction

For this interaction, we’ll need a button to trigger the interaction and our menu, which requires a div block.

Structure for this tutorial. The section holds the button and its background, while the Side Menu is a div block with styles shown in step 2.

Step 2: Style the elements

You can style your elements however you’d like, but remember to create clear, memorable class names so they’re easy to remember later.

For this example, we’ll call our div block “Side Menu” and give it the following styles:

- Fixed Position: Right (To keep it pinned to the right of the screen)

- Height: 100% (So it covers the full height of the screen when expanded)

- Width: 30%

- Background-Color: Black

Positioning styles for our sidebar menu.

Step 3: Add and style elements in our side menu

For this example, I’ll add an image, a heading, and some paragraph text—but you can feature anything you want here, from a navigation menu to an author bio.

Our sidebar menu's content. Note that its positioning is controlled by the padding set on the Side Menu.

Step 4: Add an interaction to our side menu

To keep the side menu off the screen on load, we need to add an initial appearance, and set it to move 100% to the right (so 100% of it will be off-screen).

Moving the X axis 100% keeps the menu off-screen.

Step 5: Add an interaction to the button

To make the button the trigger for the interaction, we also need to give it an interaction.

Select the button, choose the Click Trigger, check the “Affect different element(s)” box, and type in “Side Menu.” Now each of the following interaction steps will affect the side menu, not the button.

Ticking the "Affect different element(s)" checkbox lets us have the rest of the interactions we define be triggered by actions taken on the button (i.e., clicks).

Step 6: Add a first click

In this case, the first click will trigger the side menu to slide in from the right of our screen. For this step, we’ll simply move the menu back to its original on-page position, at the default speed of 500ms.

Resetting the X axis to 0 moves the side menu back on to the canvas.

Step 7: Add a second click

The second click will move the side menu back off of the screen. So in this step, we’ll move the object back to its initial appearance — 100% to the right.

Restoring the X axis to 100% on second click closes it back up again.

Step 8: Done!

And there you have it! Now in the live preview we can see that clicking the button will cause the side menu to move out from the right. Clicking it again will cause the side menu to move back — perfect!

Want to see this example for yourself? Open it in your Webflow account.

5. Zestful

Zestful helps companies book fun, unique, and local group activities available through their platform. You might expect a site like theirs to scream FUN! Well they don’t disappoint. Their upbeat vibe supports their mission to help teams socialize outside the office without the usual headache that comes with event planning.

6. Petal

Petal is a younger company, but they stand out because design pervades the focus and direction of their marketing. Even their product (a new, no-fees credit card) features a stunning and unique design. Their website follows suit — it’s a breath of fresh air — with beautiful colors, generous whitespace, and clear, concise copy.

‍Petal’s website supports their mission of providing easy credit access by making credit feel simple, approachable, and maybe a bit fun too.

7. BankMobile

BankMobile’s website makes banking look hip and modern, as hard as that might sound. With bold colors, clearly presented information and a consistent feel throughout the site, we especially appreciate the unique horizontal scrolling section they use to walk through the UI on their mobile app.

8. Bonsai

Freelancers are constantly on the lookout for new tools and products to make managing their business easier — Bonsai focuses on checking as many of those boxes as possible with tools that range from invoicing and payments to proposals and contracts. With so many features in their platform, their marketing site needs to effectively explain and differentiate how their products can help freelancers. A dedicated page for each one does just that.

‍Bonsai provides detailed product overviews with dedicated landing pages for all of their major features.

Bonsai gets bonus points for creating an impressive resource hub for freelancers. They share survey data about rates, best tools for freelancers, and the top places to find new work.

‍Bonus points for great, useful content for their freelance audience.

9. AltSchool

As an education partner, AltSchool has an important story and mission that underpins their work. Their website does a great job sharing their story with photography, copy, and a consistently communicated mission: to enable all children to reach their potential.

AltSchool uses photography and to bring their mission as educators to the fore.‍copy

Ready to build a business site of your own but not sure where to start? We’ve got you covered. Check out our full business site rebuild course on Webflow University.

Did we miss any standouts? Let us know in the comments!

Mat Vogels

Mat is a web creator and evangelist at Webflow. Follow me at @matvogels.

You might also like...

More

Join the conversation

Get free web design insights...

In your inbox, every other week. And unsubscribe in a click, if you want.

Keep an eye on your inbox!
Hmm, something went wrong. Try again?

What's Webflow?

Try it for free

Designer

Bring your wildest web designs — and client sites — to life, without writing code.

CMS

Build completely custom content structures for client sites and prototypes.

Hosting

World-class web hosting at your fingertips, without all the usual hassles.