+ 10

[SOLVED] How can I check the status of my slider menu (open or closed)?

I found JavaScript instructions for coding a slider menu on the internet and used it in my code. The button now says ā€œOpen settingsā€, but I want this to change to ā€œClose settingsā€ when the menu is open and back to ā€Open settingsā€ when it is closed. I think I need to check the status (open or closed) in the code to do this (and then use innerHTML to change the text on the button), but I have no idea how. Can anyone have a look and help me with this? https://code.sololearn.com/Wf51F6F4dQum/?ref=app

6th Apr 2019, 10:48 AM
marjel101
marjel101 - avatar
2 Answers
+ 6
You could just add extra css to alter the content based on .closed present ot not. .btn:before { content: "Close"; } .closed ~ .btn:before { content: "Open"; } https://code.sololearn.com/W3Mmqz1AzYn3/?ref=app
6th Apr 2019, 11:17 AM
CalviÕ²
CalviÕ² - avatar
+ 5
Wow, that is great CalviÕ² !! Thank you so much, really appreciate it!! šŸ™šŸ™šŸŒ¹šŸŒ¹
6th Apr 2019, 11:42 AM
marjel101
marjel101 - avatar