title: Set "active" accordion menu after click
body: <p>I'm trying to set accordion menu "active" after click on link and change the page...</p>
  
  <pre><code>&lt;div class="menu"&gt;
          &lt;dl&gt;
              &lt;dt&gt;&lt;a href="index.asp"&gt;HOME&lt;/a&gt;&lt;/dt&gt;
              &lt;dt&gt;&lt;a href="#" class="submenu"&gt;QUEM SOMOS&lt;/a&gt;&lt;/dt&gt;
                  &lt;dd&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="empresa.asp"&gt;EMPRESA&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="institucional.asp"&gt;INSTITUCIONAL&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="nossos_produtos.asp"&gt;NOSSOS PRODUTOS&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="responsabilidade_social.asp"&gt;RESPONSABILIDADE SOCIAL&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="responsabilidade_ambiental.asp"&gt;RESPONSABILIDADE AMBIENTAL&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/dd&gt;
              &lt;dt&gt;&lt;a href="#" class="submenu"&gt;PRODUTOS&lt;/a&gt;&lt;/dt&gt;
                  &lt;dd&gt;
                      &lt;ul class="produtos"&gt;
                          &lt;%do while not rscat.EOF%&gt; 
                          &lt;li&gt;&lt;a href="produtos_categoria.asp?categoria=&lt;%= rscat("categoria")%&gt;"&gt;&lt;%= rscat("categoria")%&gt;&lt;/a&gt;&lt;/li&gt;
                          &lt;%  rscat.MoveNext
                          if rscat.EOF then Exit do %&gt;
                          &lt;% Loop %&gt; 
                      &lt;/ul&gt;
                  &lt;/dd&gt;
              &lt;dt&gt;&lt;a href="informativo.asp"&gt;INFORMATIVO&lt;/a&gt;&lt;/dt&gt;
              &lt;dt class="no_border"&gt;&lt;a href="contato.asp"&gt;CONTATO&lt;/a&gt;&lt;/dt&gt;
          &lt;/dl&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>jquery:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function(){
          $('dd').hide();
          $('dt a.submenu').click(function(){
              $("dd:visible").slideUp("slow");
              $(this).parent().next().slideDown("slow");
              return false;
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>i'm trying too, use this <a href="https://stackoverflow.com/questions/10681033/accordion-menu-active-state-after-link-click">https://stackoverflow.com/questions/10681033/accordion-menu-active-state-after-link-click</a> but dont work...</p>
  
  <p>what i try (but don't work):</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
          $(document).ready(function(){
              $('dd').hide();
  
              var sPath = window.location.pathname;
              var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
              $("dt a.submenu[href='" + sPage + "']").parents("dd:visible").show();
  
  
              $('dt a.submenu').click(function(){
                  $("dd:visible").slideUp("slow");
  
                  var checkElement = $(this).next();
                  if ((checkElement.is("dd")) &amp;&amp; (checkElement.is(":visible"))) {
                      return false;
                  }
                  if ((checkElement.is("dd")) &amp;&amp; (!checkElement.is(':visible'))) {
                      $(this).parent().next().slideDown("slow");
                      checkElement.slideDown("normal");
                      return false;
                  }
  
              });
  
  
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>Well, the first sublinks <code>ul</code> point to especific pages, but the another sublink <code>ul class=produtos</code> show the categories that's on database, and uses same link on each categories like: <code>produtos_categoria.asp?categoria=xxxxxx</code>...</p>
  
  <p>If the user, click on "EMPRESA", on the page <code>empresa.asp</code> the <code>QUEM SOMOS</code> menu need to be opened. And if the user click on some categories under the menu <code>PRODUTOS</code>, on the page <code>produtos_caegoria.asp</code> the <code>PRODUTOS</code> need to be opened..</p>
  
  <p>I'm clear?</p>
  
  <p>So.. what i need to do?</p>
  
  <p>FIDDLE: <a href="http://jsfiddle.net/Qf7Js/1/" rel="nofollow noreferrer">http://jsfiddle.net/Qf7Js/1/</a></p>