M
M
mrzgt2015-11-10 14:59:45
JavaScript
mrzgt, 2015-11-10 14:59:45

How can I make the "+" change to "-" when pressed?

The site has a horizontal menu, in the mobile version I made it to expand the categories "+", I can't figure out how to change it to "-" when I click on it,
so it doesn't want to work

.fa.fa-minus{
display: none;
}
.fa.fa-plus{
  display: block;
}


.dropdown .open .fa.fa-minus  {
display: block;
}

.dropdown .open .fa.fa-minus  {
display: none;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2015-11-10
@Stalker_RED

you have the same selector described twice -.dropdown .open .fa.fa-minus

A
Alexander Zachinalov, 2015-11-10
@SanDiesel

1) The selector itself is incorrectly specified, you need to write

.dropdown.open .fa.fa-minus  {
display: none;
}

those. dropdown and open without a space
2) It won’t work for you even after the fix, because you put the icon not inside the dropdown, but in the neighborhood, and before it, and not after, you can’t even pick up the selector, or put the icon inside and then the first one will work option, or after the dropdown block and then the selector will look like this
dropdown.open + .fa.fa-plus {}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question