+ 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 Antworten
+ 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