Nav-tabs nested

Asked

Viewed 460 times

0

Friends I have a Nav-bar that is calls a Nav-tabs1 and I would like there to be another Nav-tabs2 only that when entering all the options that are called after by Nav-bar do not stay on Nav-tab1, it is opened empty and goes to Nav-tab2.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>



<div class="container">
  <h2>Dynamic Tabs</h2>
  <p>To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a .tab-pane class with a unique ID for every tab and wrap them inside a div element with class .tab-content.</p>

  <ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#home">Home</a></li>
    <li><a data-toggle="tab" href="#menu1">Menu 1</a></li>
    <li><a data-toggle="tab" href="#menu2">Menu 2</a></li>
    <li><a data-toggle="tab" href="#menu3">Menu 3</a></li>
  </ul>

  <div class="tab-content">
    <div id="home" class="tab-pane fade in active">
      <h3>HOME</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
    </div>
    <div id="menu1" class="tab-pane fade">
     <div class="container">
      <ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#principal">Principal</a></li>
    <li><a data-toggle="tab" href="#menu1.1">Menu 1.1</a></li>
    <li><a data-toggle="tab" href="#menu1.2">Menu 1.2</a></li>
    <li><a data-toggle="tab" href="#menu1.3">Menu 1.3</a></li>
  </ul>

      <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
    </div>
    
    <div id="menu1.1" class="tab-pane fade">
      <h3>Menu 1.1</h3>
      <p>TESTANDO ACESSO AO MENU 1.1.</p>
    </div>
    
    <div id="menu1.2" class="tab-pane fade">
      <h3>Menu 1.2</h3>
      <p>TESTANDO ACESSO AO MENU 1.2.</p>
    </div>
    <div id="menu1.3" class="tab-pane fade">
      <h3>Menu 1.3</h3>
      <p>TESTANDO ACESSO AO MENU 1.3.</p>
    </div>
    </div>
    <div id="menu2" class="tab-pane fade">
      <h3>Menu 2</h3>
      <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.</p>
    </div>
    <div id="menu3" class="tab-pane fade">
      <h3>Menu 3</h3>
      <p>Eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</p>
    </div>
  </div>
</div>

</body>
</html>

  • Carlos without his HTML/CSS there is no possibility that anyone can answer you. Please edit your question with the code you already have ready. I suggest you take a Tour to see how the platform works https://answall.com/tour

  • Okay, I’ve done the tour and I haven’t found any questions about the code.

  • Don’t take this the wrong way. It is that without your code and reading the question there is no way to answer you, nor put together an example that can help you understand. []s

  • All right hugocsl, I get it. I appreciate the help, man.

  • Saw how with the code is better to answer :D, if you have any questions just say

1 answer

0

From what I understood what you need would be this as below:

PS1: Do not use "." for ID selector, it can be broken in css and js. PS2: Better organize code, comments and identations to separate site sessions can be useful when you have more than one element of the same type coexisiting.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>



<div class="container">
  <h2>Dynamic Tabs</h2>
  <p>To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a .tab-pane class with a unique ID for every tab and wrap them inside a div element with class .tab-content.</p>

  <ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#home">Home</a></li>
    <li><a data-toggle="tab" href="#menu1">Menu 1</a></li>
    <li><a data-toggle="tab" href="#menu2">Menu 2</a></li>
    <li><a data-toggle="tab" href="#menu3">Menu 3</a></li>
  </ul>

  <div class="tab-content">
    <div id="home" class="tab-pane fade in active">
      <h3>HOME</h3>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
    </div>
    <div id="menu1" class="tab-pane fade">
     <div class="container">
      <ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#principal">Principal</a></li>
    <li><a data-toggle="tab" href="#menu1a">Menu 1.1</a></li>
    <li><a data-toggle="tab" href="#menu1b">Menu 1.2</a></li>
    <li><a data-toggle="tab" href="#menu1c">Menu 1.3</a></li>
  </ul>


      <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>

<div id="menu1a" class="tab-pane fade">
        <h3>Menu 1.1</h3>
        <p>TESTANDO ACESSO AO MENU 1.1.</p>
        </div>
        
        <div id="menu1b" class="tab-pane fade">
        <h3>Menu 1.2</h3>
        <p>TESTANDO ACESSO AO MENU 1.2.</p>
        </div>
        <div id="menu1c" class="tab-pane fade">
        <h3>Menu 1.3</h3>
        <p>TESTANDO ACESSO AO MENU 1.3.</p>
        </div>

    </div>
    
    
    </div>
    <div id="menu2" class="tab-pane fade">
      <h3>Menu 2</h3>
      <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam.</p>
    </div>
    <div id="menu3" class="tab-pane fade">
      <h3>Menu 3</h3>
      <p>Eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.</p>
    </div>
  </div>
</div>

</body>
</html>

  • Michel wasn’t just a problem with Ids, note that his second level of Tabs still doesn’t work, even though you changed the name of the internal Ids to Tabs not "link"....

  • Yes, I had forgotten to paste the content group of the div, the only thing you need to do is organize where the text will stay p that is between the tabs and the contents of the tabs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.