Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
bootstrap collapse show after refreshing the page?

I use bootstrap for a flask application and I want to keep sidebar menu collapsed after refreshing the page if a subclass of the sidebar is selected.

It partially works when adding "collapse show" at the div class just below this line "{% for Subclass in Class.subclasses() %}" but it shows all the subclasses of the entire sidebar. I need a solution to show the subclass of that specific class when is selected or active, not all of them.

Here is the code:

  {% for Class in owlready2.Thing.subclasses() %}
  <li class="active list-unstyled">
  <a class="btn text-white d-inline-flex align-items-start rounded" href="{{ url_for("services", iri = Class.iri) }}" role="button"  aria-expanded="true">{{ Class.name }}</a>
      
    
    <button type="button" class="btn btn-warning dropdown-toggle dropdown-toggle-split" data-bs-toggle="collapse" data-bs-target="#{{ Class.name }}" aria-expanded="true">
    <span class="visually-hidden">Toggle Dropdown</span>
  </button>

    {% for Subclass in Class.subclasses() %}
    <div class="collapse" id="{{ Class.name }}">
      <ul class="list-unstyled">
          <li><a href="{{ url_for("services", iri = Subclass.iri) }}" class="text-white d-inline-flex align-items-center rounded active"  aria-current="true">{{ Subclass.name }}</a></li>
      </ul>
    </div>
    {% endfor %}
  </li>
  {% endfor %}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!