title: JQuery add/remove class based on menu item clicked
body: <p>I am using the below jquery to show/hide three separate sidebars. Currently the script only adds the class to the relevent sidebar, and removes it on another click. Firstly, my script doesn't seem like the most streamlined approach to achieve this, and I'd also like to ensure only one sidebar can be active at any one time.</p>
  
  <p>As a bonus, i'd also like to add an .active class to the relevent menu item whenever it is applied to the associated sidebar.</p>
  
  <p>Any help Much appreciated!</p>
  
  <p><strong>HMTL</strong></p>
  
  <pre><code>&lt;nav&gt;
      &lt;ul&gt;
        &lt;li class="artists"&gt;&lt;a href="#"&gt;Artists&lt;/a&gt;&lt;/li&gt;
        &lt;li class="about"&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt;
        &lt;li class="history"&gt;&lt;a href="#"&gt;History&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/nav&gt;
  
  &lt;aside class="sidebar artists"&gt;
      &lt;li&gt;&lt;h3&gt;&lt;a href="#"&gt;Artist Name&lt;/a&gt;&lt;/h3&gt;&lt;/li&gt;
  &lt;/aside&gt;
  
  &lt;aside class="sidebar about"&gt;
      &lt;h5&gt;Biographical content&lt;/h5&gt;
  &lt;/aside&gt;
  
  &lt;aside class="sidebar history"&gt;
      &lt;h5&gt;Historical content&lt;/h5&gt;
  &lt;/aside&gt;
  </code></pre>
  
  <p><strong>SCSS</strong></p>
  
  <pre><code>/* Main nav */
  nav {
      float: right;
      margin-top: 3px;
      ul {
          margin: 0;
          height: 0;
      }
      ul li {
          display: inline-block;
          margin-right: 35px;
      }
  }
  
  .sidebar {
    width: 50%;
      height: 100%;
    position: fixed;
    top: 0;
      right: 0;
      margin-right: -50%;
      background: $black;
  }
  
  .sidebar.artists.active,
  .sidebar.about.active,
  .sidebar.history.active {
      margin-right: 0;
  }
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>$(function() {
      $( ".artists" ).click(function() {
          $( ".sidebar.artists" ).toggleClass( "active" );
      });
  });
  
  $(function() {
      $( ".about" ).click(function() {
          $( ".sidebar.about" ).toggleClass( "active" );
      });
  });
  
  $(function() {
      $( ".history" ).click(function() {
          $( ".sidebar.history" ).toggleClass( "active" );
      });
  });
  </code></pre>
  
  <p><a href="https://jsfiddle.net/eu40psjs/1/" rel="nofollow">JSFiddle</a></p>