Externally target (URL) and expand panel/accordion Boostrap. Not working?
<p>Really going crazy and I must be overlooking something, but I have no clue what.</p>

<p>I am trying to make my panel expand after clicking on an external link, for example:</p>

<pre><code>http://domain.com/test.php#headingTwo
</code></pre>

<p>The HTML looks like this:</p>

<pre><code>            &lt;div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"&gt;

              &lt;div class="panel panel-default"&gt;
                &lt;div class="panel-heading" role="tab" id="headingOne"&gt;
                  &lt;h4 class="panel-title greylinks"&gt;
                    &lt;a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"&gt;
                      Example text #1
                    &lt;/a&gt;
                  &lt;/h4&gt;
                &lt;/div&gt;
                &lt;div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne"&gt;
                  &lt;div class="panel-body"&gt;
                    &lt;p&gt;Ipsem lorem whatever #1....&lt;/p&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;

              &lt;div class="panel panel-default"&gt;
                &lt;div class="panel-heading" role="tab" id="headingTwo"&gt;
                  &lt;h4 class="panel-title greylinks"&gt;
                    &lt;a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"&gt;
                      Example text #2
                    &lt;/a&gt;
                  &lt;/h4&gt;
                &lt;/div&gt;
                &lt;div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo"&gt;
                  &lt;div class="panel-body"&gt;
                    &lt;p&gt;Ipsem lorem whatever #2....&lt;/p&gt; 
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;

              &lt;div class="panel panel-default"&gt;
                &lt;div class="panel-heading" role="tab" id="headingThree"&gt;
                  &lt;h4 class="panel-title greylinks"&gt;
                    &lt;a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"&gt;
                      Example text #3
                    &lt;/a&gt;
                  &lt;/h4&gt;
                &lt;/div&gt;
                &lt;div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree"&gt;
                  &lt;div class="panel-body"&gt;
                    &lt;p&gt;Ipsem lorem whatever #3....&lt;/p&gt; 
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;

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

<p>And the JS is like this:</p>

<pre><code>&lt;script&gt;
var activateAccordion = function (id) {
    // Get the parents
    var parents = $('a[href="#' + id + '"]').parents('.panel-group').children('.panel');

    // Go through each of the parents
    $.each(parents, function (idx, obj) {
        // Check if the child exists
        var find = $(obj).find('a[href="#' + id + '"]'),
            children = $(obj).children('.panel-collapse');

        if (find.length &gt; 0) {
            // Show the selected child
            children.removeClass('collapse');
            children.addClass('in');
        } else {
            // Hide the others
            children.removeClass('in');
            children.addClass('collapse');
        }
    });
};
&lt;/script&gt;
</code></pre>

<p>No matter what I do it seems to ignore the link completely.
It does go to the correct panel, however it doesn't expand the panel.</p>

<p>I must be overlooking something, but after several hours fooling around I cannot see it anymore. Probably some small typo somewhere.</p>

<p>Update
Added jsfiddle here: <a href="https://jsfiddle.net/DTcHh/22648/" rel="nofollow">https://jsfiddle.net/DTcHh/22648/</a></p>

<p>And in case someone misunderstood me, I am trying to create a link in email and once clicked it should load the website and go to the opened panel...</p>