title: Bootstrap 4 - Fullscreen mobile navbar
body: <p>I'm trying to figure out how I can do a fullscreen menu (navbar) on mobile size, with this I mean that when you press on the 'hamburger-menu' the navbar (with the items) should occupy all the viewport.</p>
  
  <p>I achieved this just writing:</p>
  
  <pre><code>#navbarText{
    height: 100vh;
  }
  </code></pre>
  
  <p>But the bootstrap animation isn't smooth like the default one, as you can see here (normally the animation increase the div size gradually and vice-versa when you close it):  </p>
  
  <p><a href="https://i.stack.imgur.com/XFf1C.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XFf1C.gif" alt="enter image description here"></a></p>
  
  <p>Here the code:    </p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>/*---Standar Hamburger Menu (3 separate elements)---*/
  
  .navbar-toggler {
    border: none;
    background: transparent !important;
  }
  
  .navbar-toggler:hover {
    background: transparent !important;
  }
  
  .navbar-toggler .icon-bar {
    height: 2px;
    width: 22px;
    border-radius: 1px;
    display: block;
    background-color: #B6B6B6;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
  }
  
  .navbar-toggler .icon-bar+.icon-bar {
    margin-top: 4px;
  }
  
  
  /*---Animation menu (create X)---*/
  
  .navbar-toggler.x .icon-bar:nth-of-type(1) {
    -webkit-transform: translateX(3px) rotate(45deg);
    /* Safari 3-8 &amp; Chrome 4-35 &amp; Opera 15-22 */
    -ms-transform: translateX(3px) rotate(45deg);
    /* IE 9 */
    -moz-transform: translateX(3px) rotate(45deg);
    /* Firefox 3-15 */
    -o-transform: translateX(3px) rotate(45deg);
    /* Opera 10-14 */
    transform: translateX(3px) rotate(45deg);
    -webkit-transform-origin: 10% 10%;
    -ms-transform-origin: 10% 10%;
    -moz-transform-origin: 10% 10%;
    -o-transform-origin: 10% 10%;
    transform-origin: 10% 10%;
  }
  
  .navbar-toggler.x .icon-bar:nth-of-type(2) {
    opacity: 0;
    filter: alpha(opacity=0);
    /* For IE8 and earlier */
    -moz-opacity: 0;
    /* Older Firefox 1 */
  }
  
  .navbar-toggler.x .icon-bar:nth-of-type(3) {
    -webkit-transform: translateX(3px) rotate(-45deg);
    -ms-transform: translateX(3px) rotate(-45deg);
    -moz-transform: translateX(3px)rotate(-45deg);
    -o-transform: translateX(3px) rotate(-45deg);
    transform: translateX(3px) rotate(-45deg);
    -webkit-transform-origin: 10% 90%;
    -ms-transform-origin: 10% 90%;
    -moz-transform-origin: 10% 90%;
    -o-transform-origin: 10% 90%;
    transform-origin: 10% 90%;
  }
  
  .navbar-toggler.x.collapsed .icon-bar:nth-of-type(1) {
    -webkit-transform: rotate(0);
    -ms-transform: rotate(0);
    -moz-transform: rotate(0);
    -o-transform: rotate(0);
    transform: rotate(0);
  }
  
  .navbar-toggler.x.collapsed .icon-bar:nth-of-type(2) {
    opacity: 1;
    filter: alpha(opacity=100);
    -moz-opacity: 1;
  }
  
  .navbar-toggler.x.collapsed .icon-bar:nth-of-type(3) {
    -webkit-transform: rotate(0);
    -ms-transform: rotate(0);
    -moz-transform: rotate(0);
    -o-transform: rotate(0);
    transform: rotate(0);
  }
  
  
  /*---To center elements of the navbar (mobile)---*/
  
  .navbar-brand {
    font-size: 1rem;
  }
  
  
  /*---Custom AnimateCSS mobile menu items---*/
  
  .nav-item {
    -webkit-animation-duration: 0.8s;
    /* Chrome 3-42 &amp; Safari 4-8 &amp; Opera 15-29 */
    -moz-animation-duration: 0.8s;
    /* Firefox 5-15 */
    -o-animation-duration: 0.8s;
    /* Opera 12-14 */
    animation-duration: 0.8s;
  }
  
  @media only screen and (max-width: 991px) {
    #navbarText {
      height: 100vh !important;
    }
  }
  
  @media only screen and (min-device-width: 992px) {
    .animated {
      /*CSS transitions*/
      -o-transition-property: none !important;
      -moz-transition-property: none !important;
      -ms-transition-property: none !important;
      -webkit-transition-property: none !important;
      transition-property: none !important;
      /*CSS transforms*/
      -o-transform: none !important;
      -moz-transform: none !important;
      -ms-transform: none !important;
      -webkit-transform: none !important;
      transform: none !important;
      /*CSS animations*/
      -webkit-animation: none !important;
      -moz-animation: none !important;
      -o-animation: none !important;
      -ms-animation: none !important;
      animation: none !important;
    }
    #navbarText {
      height: auto;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;title&gt;HOME&lt;/title&gt;
  
  
    &lt;!-- TODO add manifest here --&gt;
  
    &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"&gt;
  
    &lt;script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"&gt;&lt;/script&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"&gt;&lt;/script&gt;
    &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"&gt;&lt;/script&gt;
    &lt;link href="https://fonts.googleapis.com/css?family=Montserrat:200" rel="stylesheet"&gt;
  
    &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css"&gt;
  
    &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
  
    &lt;!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --&gt;
    &lt;!-- WARNING: Respond.js doesn't work if you view the page via file:// --&gt;
    &lt;!--[if lt IE 9]&gt;
        &lt;script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"&gt;&lt;/script&gt;
        &lt;script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"&gt;&lt;/script&gt;
      &lt;![endif]--&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;nav class="navbar navbar-expand-lg sticky-top navbar-dark bg-dark"&gt;
      &lt;div class="d-flex align-items-center justify-content-between w-100"&gt;
        &lt;button class="navbar-toggler navbar-toggler-left x collapsed" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation"&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                &lt;/button&gt;
        &lt;a class="navbar-brand mx-auto ml-lg-5" href="#"&gt;
          &lt;img src="https://getbootstrap.com/assets/brand/bootstrap-solid.svg" width="30" height="30" alt="Logo"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
      &lt;div class="collapse navbar-collapse mr-lg-5" id="navbarText"&gt;
        &lt;ul class="navbar-nav ml-auto"&gt;
          &lt;li class="nav-item active mx-2 animated fadeInDown"&gt;
            &lt;a class="nav-link" href="#"&gt;HOME&lt;span class="sr-only"&gt;(current)&lt;/span&gt;&lt;/a&gt;
          &lt;/li&gt;
          &lt;li class="nav-item mx-2 animated fadeInDown"&gt;
            &lt;a class="nav-link" href="#"&gt;PROJECTS&lt;/a&gt;
          &lt;/li&gt;
          &lt;li class="nav-item mx-2 animated fadeInDown"&gt;
            &lt;a class="nav-link" href="#"&gt;ABOUT&lt;/a&gt;
          &lt;/li&gt;
          &lt;li class="nav-item mx-2 animated fadeInDown"&gt;
            &lt;a class="nav-link" href="#"&gt;CONTACT&lt;/a&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;/nav&gt;
    &lt;div&gt;
      &lt;p&gt;Test&lt;/p&gt;
    &lt;/div&gt;
    &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
    &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
    &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
    &lt;p&gt;ffff&lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Do you know a way to fix it??</p>
  
  <p>If you want to edit/test the code I also leave a link to <a href="http://codeply.com/go/RL5wmpmEDG" rel="nofollow noreferrer">Codeply</a></p>