Bootstrap 3 TAB link

Permalink
Hi,

I've implementing this nested TAB system on my website :

<div class="tabbable"> <!-- Only required for left/right tabs -->
<ul class="nav nav-tabs responsive nav-justified" id="tabs">
 <?php
$tabs = $c->getAttribute('tabs');
 for( $i=0; $i<$tabs; $i++ ) {
                if ($i == 0){
                 echo '<li class="active"><a data-toggle="tab" href="#tab' . $i . '" role="tab" >' . $c->getAttribute('tab_label' . $i). '<br><i class="fa '. $c->getAttribute('tab_icon' . $i).'  fa-2x" aria-hidden="true"></i></a></li>';
                 }  else {
                   echo '<li><a data-toggle="tab" href="#tab' . $i . '" role="tab">' . $c->getAttribute('tab_label' . $i). '<br><i class="fa '. $c->getAttribute('tab_icon' . $i).'  fa-2x" aria-hidden="true"></i></a></li>';
                    }
             }
?>
             </ul>
<!-- Tab panes -->
<div class="tab-content responsive" id="my-tab-content">


I try to link from another page ta a specific bootstrap TAB.
On the address link the tab ID appear right like this : #tab2 but the TAB system stay with the first tab active.

Any idea how to make this link work from another page than where is the TAB system?

C

chrismodlao
 
hutman replied on at Permalink Reply
hutman
You could set it with javascript like this

if(window.location.hash) {
  $('.nav-tabs a[href="'+window.location.hash.substring+'"]').tab('show');
}
chrismodlao replied on at Permalink Reply
chrismodlao
So this javascript i have to put it in the footer.php file.
And any links that i will setup from a page without TAB system will send me to the right TAB on the page containing TAB system ?
JohntheFish replied on at Permalink Reply
JohntheFish
You could just use Magic Tabs. Multi-level tabs,linking to tabs and tab history are built in.
https://www.concrete5.org/marketplace/addons/magic-tabs1/...