jQuery Toggle divs/add remove class
<p>I have a pretty basic jquery script which uses an h2 as a "trigger" to toggle the div below it.</p>

<p>Seen here:</p>

<pre><code>$(".toggle-container").hide();
$("h2.trigger").click(function(){
    $(this).toggleClass("active").next().slideToggle("slow");
    return false;
});
</code></pre>

<p>I've tried to create a "toggle all" link but what happens is the divs that are open or closed aren't being recognized, so it will have the opposite effect. Here is that code:</p>

<pre><code>    $("p.toggle-all a").click(function(){
    $("h2.trigger").toggleClass("active");
    $(".toggle-container").slideToggle("slow");
});
</code></pre>

<p>Basically when the p.toggle-all a is clicked, I'd like it to recognize if the toggled divs are closed and if so, open them. Or, if they are open to close them.</p>

<p>Hopefully that makes sense. Any help or advice is greatly appreciated!</p>
