how to make a floating menu being pin or unpin with the same onclick event
<p>I have a floating menu in my aspx page and now I want to be able to pin or unpin it with an on-click event,it move with scroll but sometimes I prefer that be fixed and not move, is there any way that i can do this?</p>

<p>this is my jquery for this floating menu:</p>

<pre><code>    &lt;script&gt;
    $float_speed = 1500; //milliseconds
    $float_easing = "easeOutQuint";
    $menu_fade_speed = 500; //milliseconds
    $closed_menu_opacity = 0.75;

    //cache vars
    $fl_menu = $("#RightMenu");

    $(window).load(function () {
        if ($("#RightMenu").is(':visible'))
            menuPosition = $("#RightMenu").position().top;
        FloatMenu();

    });

    $(window).scroll(function () {
        FloatMenu();
    });

    function FloatMenu() {
        var scrollAmount = $(document).scrollTop();
        var newPosition = scrollAmount;
        if ($(window).height() &lt; $fl_menu.height()) {
            $fl_menu.css("top", menuPosition);
        } else {
            $fl_menu.stop().animate({ top: newPosition }, $float_speed, $float_easing);
        }
    }
&lt;/script&gt;
</code></pre>
