How to get a website menu to collapse after selection on mobile?

I have just put together my first site in BSS, when viewing on my iPhone, the menu remains open after selecting an item to navigate in the page. Do I need to add some custom javascript to make the menu collapse after user selects an item?

Ok sorted it, if anyone else is stuck with this, I added a scripts.js under JavaScript and added the following into that file and then it was working fine.

//Hamburger menu toggle
  $(".navbar-nav li a").click(function (event) {
    // check if window is small enough so dropdown is created
    var toggle = $(".navbar-toggle").is(":visible");
    if (toggle) {
      $(".navbar-collapse").collapse('hide');
    }
  });

? glad you found your own fix and thanks for sharing solution am sure other will appreciate it

When using Bootstrap 4 Beta 2 in Bootstrap Studio 4.0.4, I had to use the following Javascript to collapse the hamburger menu on mobile.


//Hamburger menu toggle
  $(".navbar-nav li a").click(function (event) {
    var toggle = $(".navbar-collapse").hasClass("show");
    if (toggle) {
      $(".navbar-toggler").click();
    }
  });

Great Job. Thx so much for sharing

Thanks Stefletch your code worked for me.