+ 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 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
+ 5
Wow, that is great CalviŐ˛ !! Thank you so much, really appreciate it!! đđđšđš