1

I have implemented an Offcanvas sidebar. It displays fine but none of the links in the sidebar actually work. When I clicked on the links, nothing happens. I don't think I understand the mechanism well enough so any guidance here would be appreciated.

I'm using Laravel so this code is inside a view that is loaded for every page (like app.blade.php). The sidebar works fine and can be properly toggled with the button but the links don't take me anywhere. What am I missing?

Here's the code. Link1 and Link2 are valid Laravel routes in my test app.

<body class="d-flex flex-column min-vh-100">
    <a class="btn btn-primary float-end" data-bs-toggle="offcanvas" href="#offcanvas" role="button" aria-controls="offcanvas">
        Toggle Menu
    </a>
    <nav class="offcanvas offcanvas-start show" tabindex="-1" id="offcanvas" data-bs-keyboard="false" data-bs-backdrop="true" data-bs-scroll="true">
      <div class="offcanvas-header border-bottom">
        <a href="/" class="d-flex align-items-center text-decoration-none offcanvas-title d-sm-block">
          <h4>
            My site
          </h4>
        </a>
      </div>
      <div class="offcanvas-body px-0" data-bs-target="experience-collapse" data-bs-toggle="collapse">
        
        <ul class="list-unstyled ps-0">
          <li class="mb-1">
            <button
              class="btn btn-toggle align-items-center rounded"
              data-bs-toggle="collapse"
              data-bs-target="#experience-collapse"
              aria-expanded="true"
              aria-controls="experience-collapse"
            >
            <i class="bi bi-list-ol"></i>&nbsp;&nbsp;Links
            </button>
            <div class="collapse show" id="experience-collapse" style="">
              <ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
                <li><a href="/link1" class="rounded" id="link1"><i class="bi bi-arrow-down-up"></i>&nbsp;&nbsp;Link 1</a></li>
                <li><a href="/link2" class="rounded"><i class="bi bi-search"></i>&nbsp;&nbsp;Link2</a></li>
              </ul>
            </div>
          </li>
        </ul>
      </div>
    </nav>  
  </body>
Paulo Hgo
  • 834
  • 1
  • 11
  • 26

0 Answers0