jQuery – Equalize the sidebar and content of a page

    [javascript]
    // UPDATE: Set the script as a function so that I could fire it again when the #main element is
    // resized (using https://github.com/cowboy/jquery-resize). Required when using iframes like
    // w/ Facebook widgets, Wufoo forms, or other external data that loads after the height has
    // been calculated.

    //#main is the container of #sidebar and #content

    //Wrapped the script in a function
    function equalHeight() {
    $(‘#sidebar’).css( ‘min-height’, $(‘#main’).height() );
    }

    // Run the script when the page loads
    //——————————————————–
    equalHeight();

    // Run the script again any time the #main container is resized
    //——————————————————–
    $(‘#main’).resize(function() {
    equalHeight();
    });

    [/javascript]

    Leave a Reply