title: How to close an open collapsed navbar when clicking outside of the navbar element or clicking on a link in Bootstrap 4?
body: <p>in bootstap 3 is like this =></p>
  
  <pre><code>$(document).on('click.nav','.navbar-collapse.in',function(e) {
      if( $(e.target).is('a') ) {
          $(this).removeClass('in').addClass('collapse');
      }
  });
  </code></pre>
  
  <p>how to do this in bootstrap 4 alpha 5.thanks here's the codepen of navbar 4:
  <a href="http://codepen.io/parlop/pen/BQoNNx" rel="nofollow noreferrer">http://codepen.io/parlop/pen/BQoNNx</a></p>