title: How to do javascript add class active in LI navigation menu
body: <p>I can not add class active in LI navigation menu where i click.</p>
  <p>When i click on <code>WHAT WE DO</code> on <code>home page</code> it jump to <code>what we do page</code> so i need menu <code>WHAT WE DO</code> in <code>what we do page</code> to be active.</p>
  <p>Here is my <a href="http://jsfiddle.net/smithfoto/Qy7MD/" rel="nofollow noreferrer">JSFIDDLE</a></p>
  <h2>JS</h2>
  <pre><code>$( document ).ready(function() {        
    $( &quot;#cssmenu a&quot; ).click(function(e) {
    e.preventDefault();
    var navId = $(this).attr(&quot;href&quot;);
    var str = '.' + $(this).attr('id');
      $(&quot;html, body&quot;).animate({
        scrollTop: $(navId).offset().top
      }, 600);
  
      $(str).show();
      $(this).closest('ul').find('li').removeClass(&quot;active&quot;);
      $(str).find('li').removeClass(&quot;active&quot;);
      $(str).closest('ul').find('li').addClass(&quot;active&quot;);
    });
  });
  </code></pre>