Tell me more ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

A Screenshot

Only shows the logo and main menu on mouse-over on the grey top bar. (The initial collapse is instantaneous, whether it should be animated or not may be a matter of preference.)

Sorry to not provide a file for download but i am sure you will manage somehow, adjust includes as needed:

// ==UserScript==
// @name           Collapse Headers
// @namespace      stackoverflow
// @include        *stackoverflow.com*
// ==/UserScript==

(function ()
{
    var cancelWaiting = false;
    jq_wait();

    function jq_wait()
    {
        if (typeof unsafeWindow.jQuery == 'undefined')
        {
            window.setTimeout(jq_wait, 100);
        } else
        {
            $ = unsafeWindow.jQuery;
            window.setTimeout(function () { cancelWaiting = true; }, 5000);
            $(document).ready(header_wait);
        }
    }

    function header_wait()
    {
        var items = $("#header");
        if (items.length == 0)
        {
            if (cancelWaiting) return;
            window.setTimeout(header_wait, 10);
        }
        else
        {
            items.css("overflow", "hidden");
            items.mouseenter(function ()
            {
                items.stop();
                items.animate({ height: "120px" }, 500);
            });
            items.mouseleave(function ()
            {
                items.stop();
                items.animate({ height: "38px" }, 500);
            });
            items.css("height", "38px");
        }
    }
})();

Edits:

  • Changed expand/collapse logic to not allow endless queuing.

Issues:

  • The overflow:hidden cuts off a part of the StackExchange™ MultiCollider SuperDropdown™, most visible when there are new messages in the inbox.
share|improve this question

You must log in to answer this question.

Browse other questions tagged