title: Expand jquery bootstrap panel based on window url
body: <p>I'm trying to have have a bootstrap sidebar panel list that collapses/expands based on the current page url similar to this picture.</p>
  
  <p><img src="https://i.stack.imgur.com/kopdj.png" alt="Bootstrap Expand Collapse"></p>
  
  <p>So in the picture above if any of the links under Programs &amp; Resources are the current URL then expand the Programs &amp; Resources tab and highlight the link of the current URL. The same goes for other links under Training, Certification, etc...</p>
  
  <p>Here is what I have so far. The tabs work fine and the current page gets highlighted, but I cant figure out how to open the parent tab on page load to show this panel. I think I'm using .parents or .collapse improperly.</p>
  
  <pre><code>console.log(window.location.pathname);
  jQuery('.list-group-item a[href$="' + window.location.pathname +    '"]').addClass("active").parents('.panel .panel-heading a').collapse('show');
  </code></pre>
  
  <p><a href="https://jsfiddle.net/BVmUL/1325/" rel="nofollow noreferrer">https://jsfiddle.net/BVmUL/1325/</a></p>