Using a button to toggle on and off
Aug 26, 2013
Hi all
I am trying to get a button to toggle boxes that are below it on and off. So you click the button and it shows the boxes below it and then you click the button again and the boxes disappear. You should be able to click back and forth on the button for the boxes to show and then not show.
I have tried using the visited state on the boxes below the button but then the button has been visited after the first click. i can't get it to go back and forth.
I feel like there is an easy fix but I can't figure it out for the life of me! Help!
Thanks.
8 Replies
Have a look at the attached sample. It uses a toggle trigger on the two buttons to toggle a variable and then, based ion the variable value shows/hides the boxes. Hope that's what you wanted.
Thanks so much Michael. Mine has more than one box under the button. I just copied and pasted your two triggers for those and it works; however, there is one issue still. The first click of the button doesn't do anything. You click a second time and it shows all the boxes, you click again, they disappear. I wonder why that first click isn't showing the boxes. Any thoughts?
Hm, works for me (see attached a version with three boxes per button).
Do you think me using rectangles is doing something to it instead of using "boxes" like you are? I have no idea why that would make a difference though. I just rebuilt the slide using your exact triggers and again for some reason I have to click the button twice for the items to show. Thanks Micheal, I will keep playing with it I guess.
Elaina, I'm using rectangles (Shapes) too, there is no 'secret sauce' here! What type of object you use should not make any difference. If you can, post your file here and I'll have a look.
What?! No secret sauce? Haha!
Elaina, I hope that Michael's suggestions work for you and just let us know if you need anything further.
I had a similar issue and this post pointed me in the right direction, but I did something different. I was trying to use a single button to toggle the visibility of a layer. I tried the variable ideas mentioned above but I struggled as it would move through both if statements in the triggers and not toggle anything. I wanted to pass on what worked for me... I created two triggers. The first trigger to hide the layer when the user click x if the state of x = normal. And the second trigger to show the layer when the user clicks x if the state of x is selected. I had to mess with the order so I didn't have to click twice the first time and that other layer is not visible by default. Hope this helps someone in the future.
Hi everyone! I was just working through this same issue. I had the same problem of having to click twice, but it was because of my default variable.
I have a play/pause button that toggles a playpause variable on a =NOT assignment T/F to play and pause a video on the base layer. I set it to false, or [play with pause showing] at the beginning, but it doesn't start automatically, so when I clicked the first time, it set it to true, or [pause with play showing], so the first click turned it to true, and when the button is play by default, the only thing that happened (false turning to true in the background) is invisible, making it look like you have to click it twice for it to do anything. Once I changed the default to True, it worked perfectly. In case that's confusing, I attached my file :)
This discussion is closed. You can start a new discussion or contact Articulate Support.