Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <nav class="navbar navbar-expand-md bg-dark navbar-dark">
  <!-- Brand -->
  <a class="navbar-brand" href="#">Navbar</a>

  <!-- Toggler/collapsibe Button -->
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
    <span class="navbar-toggler-icon"></span>
  </button>

  <!-- Navbar links -->
  <div class="collapse navbar-collapse" id="collapsibleNavbar">
    <ul class="navbar-nav w-100">
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="ml-auto">
        <form class="form-inline">
          <button class="btn btn-success active-search" type="button">Button</button>
        </form>
      </li>
    </ul>
  </div>
</nav>

<div class="search-dom">
  <button type="button" class="close closedMe">
    <span aria-hidden="true">&times;</span>
  </button>
  <div class="space">
    <div class="container">
     <div class="row">
       <div class="col-12 col-md-6">
         <div class="ov-h">
           <div class="search-up">
             <form class="form-inline">
               <input class="form-control mr-sm-2" type="text" placeholder="Search">
               <button class="btn btn-success" type="submit">Search</button>
             </form>
           </div>
         </div>
       </div>
     </div>
  </div>
 </div>
</div>

<div class="container-fluid" style="margin-top:80px">
  <h3>Top Fixed Navbar</h3>
  <p>A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.</p>
  <h1>Scroll this page to see the effect</h1>
</div>
              
            
!

CSS

              
                .search-dom {
  width: 100%;
  background: #ddd;
  height: 400px;
  position:fixed;
  top: 0;
  transform: translateY(-100%);
}
button.close {
  padding: 10px;
}
.ov-h {
  overflow: hidden;
}

.search-up {
  transform: translate(0, 100px);
  opacity: 0;
}

.space {
  padding: 50px 0;
}
              
            
!

JS

              
                $(document).ready(function () {
    
    // var searchReveal = $(".active-search");
    // var mainSearch = $(".search-dom");
    // var innerSearch = $(".search-up");

    const timeline = gsap.timeline()

    $(".active-search").click(function() {
        //add code for page fadeout
        //e.preventDefault();
        timeline
            .to('.search-dom', {
                duration: 0.5,
                y: '0%',
                opacity: 1
            })
            .to('.search-up', {
                duration: 1,
                delay: 0.5,
                opacity: 1,
                y: 0
            })
  });

    // var closeIt = $(".closedMe");
    $(".closedMe").click(function() {
        
        timeline.reverse(); 

    });

});
              
            
!
999px

Console