<section class="bg-primary">
  <div class="container">

<nav class="navbar navbar-expand-md navbar-dark bg-primary mb-4">
      <a class="navbar-brand" href="#">Off Canvas Navbar</a>
  
  <a href="#off-canvas" class="js-offcanvas-trigger navbar-toggle collapsed" data-toggle="collapse"  data-offcanvas-trigger="off-canvas" aria-expanded="false">
    
    
      <button class="navbar-toggler js-offcanvas-trigger" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"  data-offcanvas-trigger="off-canvas">
        <span class="navbar-toggler-icon"></span>
      </button>
    
      <div class="collapse navbar-collapse d-none" id="navbarCollapse">
        <ul class="navbar-nav mr-auto">
          <li class="nav-item active">
            <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Link</a>
          </li>
          <li class="nav-item">
            <a class="nav-link disabled" href="#">Disabled</a>
          </li>
        </ul>
        <form class="form-inline mt-2 mt-md-0">
          <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
          <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
        </form>
      </div>
    </nav>


  </div>
  <!--/.container    -->

</section>
<aside class="js-offcanvas" data-offcanvas-options='{ "modifiers": "left,overlay" }' id="off-canvas">

  <ul class="list-unstyled">
    <li>
      Customized content only shown on mobile off canvas view - Lorem ipsum dolor sit amet, consectetur adipisicing elit.

    </li>
  </ul>
</aside>
.c-offcanvas {
  left: 0;
  padding: 1rem;
  overflow-y: scroll;
}

.js-offcanvas a {
   color: #337ab7;
   outline: 0;
}


.js-offcanvas .dropdown-menu {
  position:relative;
  border:none;
}
$(document).ready(function() {
  // executes when HTML-Document is loaded and DOM is ready
  console.log("document is ready");

  $(".navbar-nav").clone().prependTo("#off-canvas");

  $(function() {
    $(document).trigger("enhance");
  });

  // document ready  
});

$(window).load(function() {
  // executes when complete page is fully loaded, including all frames, objects and images
  console.log("window is loaded");

  // window load  
});

External CSS

  1. https://npmcdn.com/js-offcanvas@1.0/dist/_css/minified/js-offcanvas.css
  2. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css

External JavaScript

  1. https://npmcdn.com/js-offcanvas@1.0/dist/_js/js-offcanvas.pkgd.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
  3. https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js
  4. https://jacoblett.github.io/bootstrap4-latest/bootstrap-4-latest.min.js