2015-01-27 2 views
1

Я использую закладки bootstrap для плагина accordian - при отображении вкладок активная вкладка имеет класс «active». Однако, когда это изменяется в соответствии с соглашением, «активный» класс отсутствует в гармоническом заголовке, и поэтому его нельзя стилизовать. любые мысли о том, как я могу получить активный класс на саксофонных титулах?Отзывчивые вкладки в accordian - bootstrap - нет активного класса

Ниже приводится ссылка на jsFiddle и код у меня есть: http://jsfiddle.net/f1kp85Lb/

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<title>Standard</title> 

<!-- Bootstrap --> 
<link href="http://www.swimmingcover.co.uk/new_build/bootstrapgrid/css/bootstrap.min.css" rel="stylesheet"> 
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
<!--[if lt IE 9]> 
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> 
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 
<![endif]--> 
<link href="http://www.swimmingcover.co.uk/new_build/bootstrapgrid/css/globalstyles.css" rel="stylesheet" type="text/css"> 
<link href="http://www.swimmingcover.co.uk/new_build/bootstrapgrid/css/product.css" rel="stylesheet" type="text/css"> 
</head> 

<body id="category"> 
<a href="#" class="scrollToTop">Scroll To Top</a> 
<div id="bag_container"> 


    <div id="main_content" class="container-fluid"> 
     <div id="main_content_container"> 

      <div class="row">  
       <section id="main_content_fw" class="col-sm-12"> 
        <div class="row" id="prd_pg_tabs"> 
         <ul class="nav nav-tabs responsive" id="myTab"> 
          <li class="active"><a class="deco-none misc-class" href="#tab_summary">Summary</a></li> 
          <li class=""><a href="#tab_fineprint">Fine Print</a></li> 
          <li><a class="deco-none" href="#tab_locations">Locations</a></li> 
         </ul> 

         <div class="tab-content responsive"> 
          <div class="tab-pane active" id="tab_summary"> 
           tab1 content 
          </div> 
          <div class="tab-pane" id="tab_fineprint"> 
           tab2 content 
          </div> 
          <div class="tab-pane" id="tab_locations"> 
           tab3 content 
          </div> 
         </div> 
        </div> 
       </section> 
      </div>   
     </div> 
    </div>  
</div> 



<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> 
<script src="http://www.swimmingcover.co.uk/new_build/bootstrapgrid/js/bootstrap.min.js"></script> 
<script src="http://www.swimmingcover.co.uk/new_build/bootstrapgrid/js/responsive-tabs.js"></script> 
<script type="text/javascript"> 
    $('#myTab a').click(function (e) { 
     e.preventDefault(); 
     $(this).tab('show'); 
    }); 

    $('#moreTabs a').click(function (e) { 
     e.preventDefault(); 
     $(this).tab('show'); 
    }); 

    (function($) { 
     //Test for making sure event are maintained 
      fakewaffle.responsiveTabs([ 'xs', 'sm' ]); 
    })(jQuery); 

    //Stops the page jumping when tab is clicked 
    $('.nav-tabs li a').click(function(e) { 
    history.pushState(null, null, $(this).attr('href')); 
    }); 
</script> 

</body> 
</html> 
+0

Ссылка на сайт плагина пожалуйста. – cvrebert

+0

Здесь http://openam.github.io/bootstrap-responsive-tabs/ –

ответ

1

Вы можете быстро добавить, динамическую функциональность вкладки просто просмотра начальной загрузки страницы, просмотр исходного кода страницы здесь:

http://getbootstrap.com/javascript/#tabs 

откладываю для вас код на bootply http://www.bootply.com/KWAuCYTA2g

<div class="bs-docs-section"> 
    <h1 id="tabs" class="page-header">Togglable tabs <small>tab.js</small></h1> 

    <h2 id="tabs-examples">Example tabs</h2> 
    <p>Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus.</p> 
    <div class="bs-example bs-example-tabs" role="tabpanel" data-example-id="togglable-tabs"> 
    <ul id="myTab" class="nav nav-tabs" role="tablist"> 
     <li role="presentation" class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">Home</a></li> 
     <li role="presentation"><a href="#profile" role="tab" id="profile-tab" data-toggle="tab" aria-controls="profile">Profile</a></li> 
     <li role="presentation" class="dropdown"> 
     <a href="#" id="myTabDrop1" class="dropdown-toggle" data-toggle="dropdown" aria-controls="myTabDrop1-contents">Dropdown <span class="caret"></span></a> 
     <ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1" id="myTabDrop1-contents"> 
      <li><a href="#dropdown1" tabindex="-1" role="tab" id="dropdown1-tab" data-toggle="tab" aria-controls="dropdown1">@fat</a></li> 
      <li><a href="#dropdown2" tabindex="-1" role="tab" id="dropdown2-tab" data-toggle="tab" aria-controls="dropdown2">@mdo</a></li> 
     </ul> 
     </li> 
    </ul> 
    <div id="myTabContent" class="tab-content"> 
     <div role="tabpanel" class="tab-pane fade in active" id="home" aria-labelledby="home-tab"> 
     <p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p> 
     </div> 
     <div role="tabpanel" class="tab-pane fade" id="profile" aria-labelledby="profile-tab"> 
     <p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p> 
     </div> 
     <div role="tabpanel" class="tab-pane fade" id="dropdown1" aria-labelledby="dropdown1-tab"> 
     <p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p> 
     </div> 
     <div role="tabpanel" class="tab-pane fade" id="dropdown2" aria-labelledby="dropdown2-tab"> 
     <p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p> 
     </div> 
    </div> 
    </div><!-- /example --></div> 


      <div id="push"></div> 

Чтобы расширить вкладку загрузки, вы можете увидеть документы здесь: http://getbootstrap.com/components/#nav-tabs

+0

Спасибо - но ни одна из них не работает как аккордеон, так как я хочу, чтобы вкладки отображались на мобильных устройствах –