code: function renderSearchBox() {
        autoCollapse();
        $(window).on('resize', autoCollapse);
        $(document).on('click', '.navbar-collapse.in', function (e) {
          if ($(e.target).is('a')) {
            $(this).collapse('hide');
          }
        });
  
        function autoCollapse() {
          var navbar = $('#autocollapse');
          if (navbar.height() === null) {
            setTimeout(autoCollapse, 300);
          }
          navbar.removeClass(collapsed);
          if (navbar.height() > 60) {
            navbar.addClass(collapsed);
          }
        }
      }
docs: Adjust the position of search box in navbar