How can I add a class to a specific div only if another div has a specific style applied to it?
<p>I have this setup:</p>

<pre><code>&lt;a id="slide-toggle" href="#"&gt;&lt;/a&gt;

&lt;div class="slide-container"&gt;
content here
&lt;/div&gt;
</code></pre>

<p>It's a jQuery slide and div.slide-container slides down when I click on a#slide-toggle.</p>

<p>div.slide-container is originally set to display:none and the style changes to display:block through inline css when I click on a#slide-toggle.</p>

<p>Basically, I want to add a class to the 'a' tag when div.slide-container is in its down position (i.e. set to display:block).</p>

<p>How would I set something like this up?</p>

<p>-edit-</p>

<pre><code>$(document).ready(function() {
    $('a#slide-up').click(function() {
        $('.slide-container').slideUp('fast'); return false;});
        $('a#slide-toggle').click(function() {
        $('.slide-container').slideToggle('fast'); return false;
        });
});

$("a#slide-toggle").click(function() {
    if ($("div.slide-container").is("visible") {
        $("div.slide-container").slideUp();
        $(this).removeClass("active");
    } else {
        $("div.slide-container").slideDown();
        $(this).addClass("active");
    }
});
</code></pre>

<p>-edit2-</p>

<p>Here is my current code:</p>

<pre><code>$(document).ready(function() {
    $('a#slide-up').click(function() {
        $('.slide-container').slideUp(); return false;});
    $('a#slide-toggle').click(function() {
        if ($('.slide-container').is(':visible')) {
            $('.slide-container').slideUp();
            $(this).removeClass('active');
        } 
        else {
            $('.slide-container').slideDown();
            $(this).addClass('active');
        }
    });
});
</code></pre>

<p>It works fine except when .slide-container is in the down position, there is a link in there (a#slide-up) which is just another way to close the container along w/ the toggle button. However, when I use that button to close the container, the toggle button remains in the active state. Any ideas?</p>
