Z
Z
zahar_922018-02-28 18:56:33
css
zahar_92, 2018-02-28 18:56:33

How to enable nested tabs in Bootstrap 3?

Hello!
There are tabs on bootstrap 3 with nested tabs.
Purpose: when clicking on top-level tabs, the first nested tab is activated and displays its content accordingly.
The structure is as follows:
City 1, City 2
City 1 -> Tab 1, Tab 2, Tab 3
City 2 -> Tab 4, Tab 5, Tab 6

<ul id="city" class="nav nav-tabs">
  <li><a data-toggle="tab" href="#city1">Краснодар</a></li>
  <li><a data-toggle="tab" href="#city2">Сочи</a></li>
</ul>
<div class="tab-content">
  <div id="city1" class="tab-pane fade">
    <ul class="nav nav-tabs">
      <li class="active"><a data-toggle="tab" href="#address1">Аэропорт «Пашковский»</a></li>
      <li><a data-toggle="tab" href="#address2">ЖД вокзал «Краснодар-1»</a></li>
      <li><a data-toggle="tab" href="#address3">ТРЦ «Красная площадь»</a></li>
    </ul>
  </div>
  <div id="city2" class="tab-pane fade">
    <ul class="nav nav-tabs">
      <li><a data-toggle="tab" href="#address4">Аэропорт «Адлер» (Сочи)</a></li>
      <li><a data-toggle="tab" href="#address5">ТРЦ »МореМолл»</a></li>
    </ul>
  </div>
</div>

And the active city already shows its text. Now, when switching to the second city, the active tab remains in the first city, and only after clicking on the desired tab of the second city, the content changes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Yanyshev, 2018-02-28
@villiwalla

Look at the tab buttons in the first tab, see the active class? Look at the tab buttons in the second tab, see there is no active class? And yes, do you see the absence of something important in the tab buttons for cities? For example active?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question