change class on div with jquery
<p>I have a div that changes class depending on where the user is on the page using jquery. This function looks like this.. </p>

<pre><code>$(function(){

    var menu = $('#menu'),
        pos = menu.offset();

        $(window).scroll(function(){
            if($(this).scrollTop() &gt; pos.top+menu.height() &amp;&amp; menu.hasClass('default')){
                menu.fadeOut('slow', function(){
                    $(this).removeClass('default').addClass('fixed').fadeIn('slow');
                });
            } else if($(this).scrollTop() &lt;= pos.top &amp;&amp; menu.hasClass('fixed')){
                menu.fadeOut('slow', function(){
                    $(this).removeClass('fixed').addClass('default').fadeIn('slow');
                });
            }
        });

});
</code></pre>

<p>But I also want to change the div class when clicking on a link/button with a special class/name.</p>

<p>I made a bad try .. But how could I incorporate this in the previous function? with a "if else" ..</p>

<pre><code>$(".closemeny").click(function() {
    menu.fadeOut('slow', function(){
        $('#menu').removeClass('fixed').addClass('default').fadeIn('slow');
});
</code></pre>
