javascript function not working correctly
<p>I have the following simple javascript function to slide an object up and down.</p>

<p>When I first click it should slide down which it should do and alerts with true which it should do.  However on the second click I want it to slideup however it detects firstclick to be true again.  Any ideas</p>

<pre><code>&lt;script type="text/javascript"&gt;
var firstclick = true;


function slidedown(){

    if (firstclick = true){


        $( '#rerooftext' ).slideDown(500);  

        alert(firstclick);
        firstclick = false;
    }

    else {
        $('#rerooftext').slideUp(500);
        $firstclick = true;
    }
}





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