How to use the same toggle comment with two different ID/Classes
<p>I want to make an expanding sidebar, I was able to make the sidebar expand but but I need to cover the original button that was pressed. </p>

<p>I would like to have an area at the side where I can click to close the sidebar. </p>

<p>I'm almost there. The problem i'm having is that the close id when clicked does not seem to trigger the toggle. </p>

<p>here is my code</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$("#icon-menu-mobile,#exit").each(function() {
  $(this).click(function() {
    var effect = 'slide';
    var options = 'left';
    var duration = 500;

    $('#panel').toggle(effect, options, duration);
  });
});</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>#panel {

  position: absolute;

  top: 0px;

  width: 100%;

  height: 100%;

  background-color: rgba(0, 0, 0, 0.3);

  display: none;

  z-index: 999;

}

.panelcontent {

  position: relative;

  top: 50px;

  width: 70%;

  height: 100%;

  background-color: #cccccc;

  float: left;

}

#icon-menu-mobile {

  width: 36px;

  height: 30px;

  cursor: pointer;

  font-size: 24px;

}

#icon-menu-mobile,

#exit {

  position: static;

  float: right;

  width: 30%;

  height: 100%;

  cursor: pointer;

}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;

&lt;body&gt;


  &lt;span id="icon-menu-mobile"&gt;
 ☰      
&lt;/span&gt;

  &lt;div id="panel"&gt;
    &lt;div class="panelcontent"&gt;
      Some text here to fill it out

    &lt;/div&gt;
    &lt;div id="exit"&gt;
      Click here to exit
    &lt;/div&gt;

  &lt;/div&gt;

&lt;/body&gt;</code></pre>
</div>
</div>
</p>

<p>As you can see after clicking the burger menu you can't close it with the side close button. </p>

<p>I'm guessing that the toggle only works from the first id clicked and that id needs to be clicked again to toggle again. </p>

<p>Is there a way to have two id's activate the same toggle? </p>