Have an Open/Close Effect with Layers
May 31, 2022
By
Steven Caban
I want information (slide layer) to show or hide in a slide when the user continuously clicks a button the slide (an open/close effect). I was able to create triggers to only once "open and close" the layer. Once I closed the layer after opening, I could not open again.
My work:
- Created a trigger: Show Layer X, when the user clicks ButtonX, If the state of ButtonX = Normal, and the state of ButtonX = Selected. (I also attempted this with both states as selected)
- Created a trigger: Hide Layer X, When the user clicks ButtonX, If the state of ButtonX = Visited.
I attempted several states for the button but the only result I get is being able to show and hide the layer. I am unable to have it show again.
Thanks
4 Replies
Hi, Steven.
Thank you for reaching out!
My suggestion is to toggle a True/False variable when the user clicks the button, and use that value as a condition of showing or hiding the layer:
Example:
I hope this helps!
I would add a hide trigger before the show trigger
Depending on what you are doing, you could also add a selected state to the button and use the selected state as a trigger. Example here.
Of course, using variables gives you more granular control if you add more complexity to the interaction.
Hi Steven, I did something similar using layers and hotspots here is a link to the post where you can also download the SL file to see how I did it. View