Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

586
Views
Cómo agregar la pestaña "TODO" a la pestaña del menú dinámicamente

Tengo una lista de pestañas dinámica, quería agregar una pestaña "Todos". El clic de la pestaña "3todos" muestra todos los botes.

Para este código, solo muestra la pestaña dinámica, por lo tanto, estoy buscando una solución para agregar una pestaña "Todos"

Probé alguna solución pero no llego

La idea es agregar la pestaña atática "Todos"

 <?php echo '<ul class="nav nav-tabs" role="tablist">'; $args = array( 'taxonomy' => 'annualreports_category', 'hide_empty'=>0, 'orderby' => 'name', 'order' => 'ASC' ); $categories = get_categories($args); foreach($categories as $category) { echo '<li> <span data-href="'.$category->slug.'" role="tab" data-toggle="tab"> '.$category->name.' </span> </li>'; } echo '</ul>'; echo '<div class="investors-content">'; foreach($categories as $category) { echo '<div class="tab-pane" id="' . $category->slug.'">'; $catslug = $category->slug; $the_query = new WP_Query(array( 'post_type' => 'annualreports_post', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'annualreports_category', 'field' => 'slug', 'terms' => array( $catslug ), 'operator' => 'IN' ), ), )); while ( $the_query->have_posts() ) : $the_query->the_post(); echo '<h1>'; the_title(); echo '</h1>'; endwhile; echo '</div>'; } echo '</div>'; ?> <script> $(".investors-content .tab-pane").each(function(){ $(this).hide(); $('.investors-content .tab-pane:first-child()').show(); }); $('.nav-tabs li>span').on( "click", function(e) { e.preventDefault(); var id = $(this).attr('data-href'); $(".investors-content .tab-pane").each(function(){ $(this).hide(); if($(this).attr('id') == id) { $(this).show(); } }); });
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Verifique este ejemplo de trabajo similar a su requisito

 $('#tabAll').on('click',function(){ $('#tabAll').parent().addClass('active'); $('.tab-pane').addClass('active in'); $('[data-toggle="tab"]').parent().removeClass('active'); });
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> <div class="container"> <h2>Dynamic Tabs</h2> <p>To make the tabs toggleable, add the data-toggle="tab" attribute to each link. Then add a .tab-pane class with a unique ID for every tab and wrap them inside a div element with class .tab-content.</p> <ul class="nav nav-tabs"> <li><a id="tabAll" href="#">All</a></li> <li class="active"><a data-toggle="tab" href="#home">Home</a></li> <li><a data-toggle="tab" href="#menu1">Menu 1</a></li> </ul> <div class="tab-content"> <div id="home" class="tab-pane fade in active"> <h3>HOME</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> </div> <div id="menu1" class="tab-pane fade"> <h3>Menu 1</h3> <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> </div> </div> </div>

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!