+ 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
2 odpowiedzi
+ 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
+ 5
Wow, that is great Calviղ !! Thank you so much, really appreciate it!! 🙏🙏🌹🌹