Commit 64a90b4a authored by Ivica Puljic's avatar Ivica Puljic Committed by Ivica Puljic
Browse files

Issue #3316119 by pivica: Toggle active path in sidebar only once on first sidebar show

parent 670f5bbf
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -316,14 +316,16 @@
      });
    }

    // Toggle active paths.
    // Toggle active path on first sidebar show.
    // @TODO - note that this can still fail if we have multiple toggler buttons
    // on page and user use multiple of them on same page. But this should not
    // happen hopefully or we need to refactor this more with additional state
    // var.
    $('.navbar-toggler').each(function () {
      var $this = $(this);
      var $navbar = $($this.data('target')).find('.navbar-nav');

      $this.click(function () {
      var $navbar = $(this.dataset.target).find('.navbar-nav');
      this.addEventListener('click', function () {
        toggleActivePath($navbar, true);
      });
      }, {once: true});
    });

    if (drupalSettings.bs_bootstrap.navbar_offcanvas_type) {