simon
simon

Reputation: 33

toggleClass jQuery class assignment

how can i assign the "navMenu__logo .transparent" to toggleClass? It will work with the .transparent class if i comment it out.

    $(document).ready(function(){
      
      $( ".navMenu__logo" ).click(function() {
        $( this ).toggleClass( "transparent" );
      });

    });
.navMenu__logo .transparent {
  opacity: 0.1;
}

/*
  .transparent {
    opacity: 0.1;
  }
*/

Upvotes: 1

Views: 47

Answers (1)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

It should have no space between:

// -----------v
.navMenu__logo.transparent {
  opacity: 0.1;
}

Giving a space, you're telling the .transparent element is inside .navMenu__logo which isn't the case.

Upvotes: 4

Related Questions