ZombieChowder
ZombieChowder

Reputation: 1204

Changing element visibility on toggle

I am currently trying to remove the visibility of a few elements inside a side menu on toggle. I am currently using Bootstrap 4 and I'm quite unsure how to do it with the newly implemented changes. Here is a JS Fiddle on what I've currently done: Fiddle Number 1

I am trying to change the visibility of text inside the li elements, so that when the button is not clicked, they are not visible on the menu.

I've tried using this code but it doesn't seem to work:

$("#menu-toggle").toggle(
    function(){$("span").css({"visibility": "visible"});},
    function(){$("span").css({"visibility": "hidden"});},
});

How can I hide and display the text inside the span with toggling the button?

Upvotes: 2

Views: 210

Answers (1)

Chiller
Chiller

Reputation: 9738

Just add this css code

.toggled span {
  visibility: visible;
}

this will make the spans visible when the side bar is toggled

See updated jsfiddle

Upvotes: 1

Related Questions