Forum Discussion

StevenCaban's avatar
StevenCaban
Community Member
3 years ago

Have an Open/Close Effect with Layers

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

  • 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:

    Windows 10 (1) 2022-05-31 at 9.50.50 AM

    Example:

    Screen Recording 2022-05-31 at 09.49.18 AM

    I hope this helps!

  • 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

    • JohnBishop-6aa8's avatar
      JohnBishop-6aa8
      Community Member

      Nice Gerry, genius move putting the rollover in the layer, really simplified this for me.  I was stuck figuring out how to do this with rollovers on the main layer. They were not needed. Much better this way!  Thanks!

  • I came up with these triggers and it works fine. (I have visited states for objects as well)