title: How to prevent empty space when fading in/out div to avoid momentary site collapse
body: <p>I am using a script to allow the user to alternate between view modes (Grid, List, and Full). When the user changes view modes, the active view fades out and the selected fades in. During that transition, there is empty space and as my site is responsive I do not want to set a fixed max-height to the content.</p>
  
  <p>As you can see from the following, the footer jumps up when you switch view modes..</p>
  
  <p><a href="http://fiddle.jshell.net/9ae3T/12/" rel="nofollow">http://fiddle.jshell.net/9ae3T/12/</a></p>
  
  <p>Does anyone now a method to set a new max-height for the content each time the view mode is set? (Thereby avoiding the momentary negative space and adjusting to the height of the active content?)</p>
  
  <p>HTML:</p>
  
  <pre><code> &lt;ul class="tabs js-view-mode"&gt;
        &lt;li&gt;&lt;a href="#list"&gt;List&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#grid"&gt;Grid&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="#full"&gt;Full&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  
      &lt;section id="viewMode" class="content"&gt;
        &lt;div id="list"&gt;here is list mode content&lt;/div&gt;
        &lt;div id="grid"&gt;here is grid mode content&lt;/div&gt;
        &lt;div id="full"&gt;here is full mode content&lt;/div&gt;
      &lt;/section&gt;
  
  &lt;footer&gt;&lt;/footer&gt;
  </code></pre>
  
  <p>JQUERY:</p>
  
  <pre><code>$(document).ready(function(){
    var wrap = $('#viewMode'),
        viewMode = $.cookie( 'view-mode' );
    wrap.children().hide();
  
    $('.js-view-mode').on( 'click', 'a',function( e ){
      e.preventDefault();
      var t = $(this),
          type = t.attr('href');
  
     wrap.children().fadeOut(); $(type).delay(500).fadeIn();
  
      viewMode = $.cookie( 'view-mode', type );
  
    });
  
    if ( viewMode ) {
      $('.js-view-mode a[href='+ viewMode +']').trigger('click');
    } else {
      $('.js-view-mode li:first a').trigger( 'click' );
    }
  
  });
  </code></pre>
  
  <p>CSS (for demonstrative purposes):</p>
  
  <pre><code>footer {background: red; display: block; width: 100%; height: 5px}
  
  #list {height: 20px; width: 100%;display: block}
  #grid {height: 55px; width: 100%;display: block}
  #full {height: 100px; width: 100%;display: block}
  
  /*.content {THIS NEEDS TO BE SET TO THE ACTIVE VIEWMODE CONTENT HEIGHT} */
  </code></pre>