0
votes

I'm trying to make a bootstrap site with nav-tabs navigation. I cant seem to figured out why my tabs do not load the content in its tab-pane. I can get it to work in a tutorial but on on my project. Any help would be appreciated. I just wanted the tabbed content to appear when i click its link. Currently its staying on the first tab and it doesn't move. thank you!

<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
    <link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"
    rel="stylesheet" type="text/css">
    <link href="http://pingendo.github.io/pingendo-bootstrap/themes/default/bootstrap.css"
    rel="stylesheet" type="text/css">
    <script>
        $(function () {
            $('#myTab a:first').tab('show')
          })
    </script>
</head>

<body>
    <div class="cover">
        <div class="navbar">
            <div class="container">
                <ul id="myTab" class="nav nav-tabs nav-justified">
                    <li class="active">
                        <a href="#home">Home</a>
                    </li>
                    <li>
                        <a href="#profile">Profile</a>
                    </li>
                    <li>
                        <a href="#messages">Messages</a>
                    </li>
                    <li>
                        <a href="#settings">Settings</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="home">Your Home tab content here</div>
                    <div class="tab-pane" id="profile">Your Profile tab content here</div>
                    <div class="tab-pane" id="messages">Your Messages tab content here</div>
                    <div class="tab-pane" id="settings">Your Settings tab content here</div>
                </div>
            </div>
        </div>
        <div class="cover-image" style="background-image: url(https://unsplash.imgix.net/photo-1418065460487-3e41a6c84dc5?q=75&amp;fm=jpg&amp;s=127f3a3ccf4356b7f79594e05f6c840e);"></div>
        <div class="container">
            <div class="row">
                <div class="col-md-12 text-center">
                    <h1 class="text-inverse">Heading</h1>
                    <p class="text-inverse">Lorem ipsum dolor sit amet, consectetur adipisici eli.</p>
                    <br>
                    <br>
                    <a class="btn btn-lg btn-primary">Click me</a>
                </div>
            </div>
        </div>
    </div>
</body>

1
See this bootply.com/FArUNyj3TY in conjunction with madaaah's answer: You're missing data-toggle:"tab" on your <li><a href="#..." data-toggle="tab">...</a></li> elements.Tim Lewis
ahhh thank you so much!!!!!!Sid Hernandez

1 Answers

1
votes

This is the code provided by Boostrap on their Documentation, in your code I can see that there is far less attributes on the structure, probably the lack of one is messing with the functioning.

Data-toggle and role are the more likely ones.

Good luck. ;)

 <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
    <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
    <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
    <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="home">...</div>
    <div role="tabpanel" class="tab-pane" id="profile">...</div>
    <div role="tabpanel" class="tab-pane" id="messages">...</div>
    <div role="tabpanel" class="tab-pane" id="settings">...</div>
  </div>