I am after a nav-tab
that does not involve the URL changing but obviously the tabs change and display the relevant information.
I have an angularjs
site but whenever the page refreshes it take the user back to the search page. As the normal twitter bootstrap nav-tabs
changes the URL I can not use this but it's something I want to do.
Questions are:
nav-tabs
Below is cut of my code:
<div class="row" data-ng-if="showcharts">
<div class="col-md-12">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#productBreakdown" role="tab" data-toggle="tab"><span class="tabHeadings">Product breakdown</span></a></li>
<li role="presentation" style="border-right: 1px solid lightgray; border-left: 1px solid lightgray"><a href="#assetsBreakdown" role="tab" data-toggle="tab"><span class="tabHeadings">Assets Breakdown</span></a></li>
<li role="presentation"><a href="#nbBreakdown" role="tab" data-toggle="tab"><span class="tabHeadings">New Business Breakdown</span></a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="productBreakdown">
<donutchart id="product-breakdown" data-options="productbreakdownchart"></donutchart>
</div>
<div role="tabpanel" class="tab-pane" id="assetsBreakdown">
<donutchart id="asset-breakdown" data-options="assetbreakdownchart"></donutchart>
</div>
<div role="tabpanel" class="tab-pane" id="messages">TO BE ADDED</div>
</div>
</div>
</div>
Each tab will display an informational chart to the user.
Approach: To create a tabbed navigation menu, create a basic unordered list with list items as links. Then add classes nav and nav-tabs of bootstrap to unordered list and nav-items class to list items. Example 1: HTML.
tab=x (where x=tab number) to the URL to display the specific tab. For example: https://demo.dj-extensions.com/dj-tabs/?tab=4 will open 4th tab on the demo site, you can try changing the number to another one to see how it works.
You can activate a tab or pill navigation without writing any JavaScript by simply specifying data-toggle="tab" or data-toggle="pill" on an element. Adding the nav and nav-tabs classes to the tab ul will apply the Bootstrap tab styling, while adding the nav and nav-pills classes will apply pill styling.
You can activate a tab or pill navigation without writing any JavaScript code — simply specify the data-bs-toggle="tab" on each tab, or data-bs-toggle="pill" on each pill, as well as create a . tab-pane with unique ID for every tab and wrap them in .
As you said in comments url changes due to the href
attribute in the <a>
tag. But you can leave href
blank use data-target="..."
attribute instead. So
<a href="#productBreakdown" role="tab" data-toggle="tab"></a>
will be
<a href data-target="#productBreakdown" role="tab" data-toggle="tab"></a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With