Sha256: cfbdc5c45acf7834c451c35ff0e203bb922269a64d395f5b71ce7140f0232d6b

Contents?: true

Size: 1.6 KB

Versions: 12

Compression:

Stored size: 1.6 KB

Contents

<header id="header-is_fixed">
  <%= render partial: "forever_style_guide/sections/components/navigation/marketing" %>
</header>
<div class="container l-section">
  <div class="card l-section-far l-padded-thick" style="min-height: 800px;">
  <h1>Fixed Navigation</h1>
    <p>To implement fixed navigation:</p>
    <ol>
      <li>Add an id of "header-is_fixed" to the main &lt;header&gt; element</li>
      <li>Add top padding to the &lt;body&gt; to match the height of the header (in most cases this will be equal to the $header_height variable unless there's a subnav or additional fixed elements.)</li>
      <li>Include the nav-fixed.js snippet</li>
    </ol>
    <p>How it works:</p>
    <ul>
      <li>On the desktop the header is fixed and behaves as any other fixed element</li>
      <li>In mobile contexts, we have to make sure that the nav is scrollable when expanded beyond the height of the viewport
        <ul>
          <li>We can rely on <a href='http://getbootstrap.com/javascript/#dropdowns-methods'>Bootstrap's Dropdown Methods</a> to help here.</li>
          <li>When a dropdown w/ in the nav is expanded we check to see if this makes the height of the header greater than the height of the viewport</li>
          <li>If it is greater, we give the header a max height equal to the viewport height to allow for vertical scrolling w/ in the header.</li>
          <li>We make the body (now behind the header) fixed so it does interfere w/ scrolling.</li>
          <li>When the dropdown or the collapse nav is closed, we make sure the body is no longer fixed</li>
        </ul>
      </li>
    </ul>
  </div>
</div>
    

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
forever_style_guide-2.0.3 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-2.0.2 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-2.0.1 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-2.0.0 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-1.2.11 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-1.2.10 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-1.2.9 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-1.2.8 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-1.2.7 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-1.2.5 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-1.2.4 app/views/forever_style_guide/demo/navigation-fixed.html.erb
forever_style_guide-1.2.3 app/views/forever_style_guide/demo/navigation-fixed.html.erb