How to dynamically set the "nav-link active" class in nav-pills?

1 reply · opened Apr 6, 2019

JjcamargonetoApr 6, 2019

I'm using HTML5 Canvas in a Django/Python project with HTML templates.
I don't know how to dynamically set the "nav-link active" class in nav-pills.
Would you help me?

      <ul class="nav nav-pills">
        {% for categ in categlista %}
          <li class="nav-item">[{{ categ.title }}]({% url 'url_postlista' categ.id %})
        {% endfor %}

At this way above all nav-items are "active" and I need that only the clicked item be "active".

SSemicolon WebSTAFFApr 7, 2019

Hello,

We Apologize about the Inconveniences, however, we currently do not provide Customization Support according to the Item Support Policy: https://themeforest.net/page/item_support_policy . You will need to manually code this or Hire a Freelancer to help you out.

According to your usage scenario, you will need to check the Page URL and then match it with the href of the Nav Pill to add the .active Class.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard