html - Anchor links for accordion menu not working (Bootstrap 3) -


i have accordion menu on bootstrap page, , i'm trying include links in text take reader anchor on same page, within different tabs of menu (so don't have scroll down , click on tabs). works first tab though. doing wrong? here's js fiddle (sorry typos in code! weren't mine...)

and here's code:

<p>go <a href="#tab1">tab1</a>.</p> <p>go <a href="#tab2">tab2</a>.</p> <p>go <a href="#tab3">tab3</a>.</p>  <section id="content">     <div class="container">         <div class="row">             <div class="col-xs-12 wow fadeindown">                <div class="tab-wrap">                      <div class="media">                         <div class="parrent pull-left">                             <ul class="nav nav-tabs nav-stacked">                                 <li class="active"><a href="#tab1" data-toggle="tab" class="analistic-01"><i class="fa fa-comments"></i>tab1</a></li>                                 <li class=""><a href="#tab2" data-toggle="tab" class="tehnical"><i class="fa fa-pencil-square-o"></i>tab2</a></li>                                 <li class=""><a href="#tab3" data-toggle="tab" class="tehnical"><i class="fa fa-check-square-o"></i>tab3</a></li>                                                                </ul>                         </div>                          <div class="parrent media-body">                             <div class="tab-content">                                  <div class="tab-pane fade active in" id="tab1">                                     <div class="media">                                        <div class="pull-left">                                            <img class="img-responsive" src="images/services/tab1-1.png">                                            <br>                                            <img class="img-responsive" src="images/services/tab1-2.png">                                            <br>                                            <img class="img-responsive" src="images/services/tab1-3.png">                                         </div>                                         <div class="media-body">                                             <a name="tab1"></a>                                             <h2>tab1</h2>                                             <p>tab1tab1tab1.</p>                                                                  </div>                                     </div>                                 </div>                                   <div class="tab-pane fade" id="tab2">                                     <div class="media">                                        <div class="pull-left">                                            <img class="img-responsive" src="images/services/tab2.jpg">                                         </div>                                         <div class="media-body">                                             <a name="tab2"></a>                                            <h2>tab2</h2>                                                <p>tab2tab2tab2.</p>                                                                                             </div>                                     </div>                                  </div>                                   <div class="tab-pane fade" id="tab3">                                      <div class="media">                                          <div class="pull-left">                                              <img class="img-responsive" src="images/services/tab3.jpg">                                          </div>                                          <div class="media-body">                                              <a name="tab3"></a>                                              <h2>tab3</h2>                                              <p>tab3tab3tab3 </p>                                           </div>                                      </div>                                  </div>                              </div> <!--/.tab-content-->                           </div> <!--/.media-body-->                      </div> <!--/.media-->                      </div><!--/.tab-wrap-->                            </div><!--/.col-sm-6-->         </div><!--/.row-->     </div><!--/.container--> 

i suggest take detailed read on twitter bootstrap's documentation on "tab methods" @ http://getbootstrap.com/javascript/#tabs

by anchor linking individual tabs first tab or active tab since other tab contents hidden nature.

the solution seeking need links bind "tab show" method follows,

$('#sometab').tab('show') 

this selects given tab , shows associated content. other tab selected becomes unselected , associated content hidden.

i assume have bootstrap.min.js included ensure methods available.

edit: i have created demo here you http://jsfiddle.net/trj87ytj/34/

hope helps!


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -