Forum Documentation Showcase Pricing Learn more

Open menu and close menu from same button?


#1

How do I use the same menu button to open and close a menu?

I have a button that when I click it animates a group - open menu.

How do I use the same button to close the group?


#2

In the workflow, you can use the “Only When” field to do this type of logic:

When the Button is clicked, and Only When Menu is Visible, then do…
When the Button is clicked, and Only When Menu is Not Visible, then do…

So you can either have 2 separate workflow events, or one workflow event with different steps that trigger depending on whether or not the menu is visible.


#3

You can also use the “Toggle” action, which shows an element when hidden and hides the element when visible. Andrew’s solution is great for when you have other conditions going on regarding visibility, but the toggle action is cool for a simple switch back and forth.


#4

Thanks :slight_smile:


#5

Both good solutions thanks :slight_smile:


#6

Hi All,

I have used a toggle work flow to create a menu but I cannot get it to sit on top of the content on the home page. Not only does it look rubbish but it is messing with my functionality, the lower of the two red boxes it showing that then i click one of the elements on the menu it triggers a workflow on the home page.

Anyone know how to fix this?

image


#7

Hi all,

Is anyone able to provide some insight on my last post?


#8

Please provide link to your app and it will help answering your question by Bubble users.