Toggle Buttons
imagine a little button that you touch once to turn on a light and twice to turn it off
In web development, we call this a toggle switch. Calling the toggle class once turns something on and calling it again will turn it off.
An example of this is when you have a little hamburger button with three lines and you want to click on this to show or hide the sidebar menu.
Typically, as in the case of the template I was using the menu will show on large screens by default and you can press the hamburger menu to hide it and it will be hidden on smaller screens.
Well, my client wanted the menu to always be hidden by default. I tried to call the toggled class to have the menu collapsed as if you had already pressed the toggle on the page loading, but since the theme had some behavior that had the menu show on large screens but not on small screens, this didn’t work.
Since this was very important to the client that it looks right, so he can sell his product and earn money, I spent the time to write code to override that default behavior and hide the sidebar by default until the button is pressed.
This took some creative #webdevelopment thinking and researching until I came up with a solution that worked across all screen sizes, thus enabling my client to sell his now user-friendly software and make more money.
How would you handle such a situation? Let me know your thoughts and comments.
I am a web developer who comes up with creative solutions for your web and software problems, helping you earn more money.
Please contact me at shoshanaz@techsolvesz.com