title: Make child page active when clicked from google
body: <p>I have got a working vertical accordion menu that creates an active class and saves when moving from page to page throughout the website. The problem I have is that when I go to a child page from google for example, the accordion menu won't drop down and show that active class. </p>
  
  <p>I am using cookies to save the class when going from page to page. Will I use a similar technique to capture the page that it's on when searching from google?</p>
  
  <p><a href="http://jsfiddle.net/tebrown/uzrbbqx9/4/" rel="nofollow">http://jsfiddle.net/tebrown/uzrbbqx9/4/</a></p>
  
  <pre><code>    $('#cssmenu &gt; li:has(ul)').addClass("has-sub");
  
      var checkCookie = $.cookie("nav-item");
      if (checkCookie != "") {
          $('#cssmenu &gt; li &gt; a:eq(' + checkCookie + ')').addClass('active').next().show();
      }
      checkCookie = $.cookie("sub_nav-item");
      if (checkCookie != "") {
          $('#cssmenu &gt; li &gt; ul &gt; li &gt; a:eq(' + checkCookie + ')').addClass('active').next().show();
      }
  
  
      $('#cssmenu &gt; li &gt; ul &gt; li &gt; a').click(function () {
          var navIndex = $('#cssmenu &gt; li &gt; ul &gt; li &gt; a').index(this);
          $.cookie("sub_nav-item", navIndex);
          var checkElement = $(this).next();
  
  
          $(this).removeClass('testing');
          $(this).closest('li').addClass('testing');
          $('#cssmenu li li .active').removeClass('active');
          $(this).addClass('active');
      });
  
      $('#cssmenu &gt; li &gt; a').click(function () {
          var $a = $(this),
              $ul = $a.next(),
              navIndex = $('#cssmenu &gt; li &gt; a').index(this);
  
          $.cookie("nav-item", navIndex);
          $('#cssmenu li a.active').not(this).removeClass('active').next().stop().slideUp();
  
          if ($ul.is(':animated'))
              return;
  
          $ul.stop().slideToggle();
          $a.toggleClass('active');
  
          });
  </code></pre>
  
  <p>Any help would be much appreciated. </p>
  
  <p>Cheers</p>