I am trying to implement a sidebar as show on example 4 on the interaction page, with the difference that on the second click of the same button I would like the side bar to close.
So in essence:
- The first click of the ‘Login’ button would open the sidebar. (Nothing unusual here)
- The second click of this button would
close the sidebar (This is different to your example) - And there is an ‘X’ button on
the sidebar to close it (similarly to your example)
Problem:
If I open the sidebar with the ‘Login’ button, then close it with the ‘X’ button, the ‘Login’ button takes two clicks to open the side bar again.
I assume this is because I am assigning two separate scripts for the two buttons, and at this point the ‘Login’ button is expecting the ‘second click’,which is set up to close the sidebar and not to open it. Yet, I don’t know what to do about it. Is there different way of doing this so this does not happen? I tried to link the ‘X’ button to the first script and just use one script, but that resulted in having to press the ‘X’ button twice to close the sidebar.
Thanks