Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
Boostrap 4 Carousel: enable keyboard navigation without focus

Is it somehow possible to activate the keyboard navigation on a Bootstrap 4 carousel directly on page load and not just after focusing on the navigation arrows?

Right now I have the following (working) carousel. The keyboard navigation works properly but just after focusing on the carousel's arrows. What I would like is to activate this directly on page load.

<?php if( have_rows('images') ): ?>
<!-- The carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="2000" data-pause="hover" data-keyboard="true">

 <!-- Indicators -->
 <ul class="carousel-indicators">
 <?php
                $active = 'active';
                $num = 0;
                while ( have_rows('images') ) : the_row();
                $image = get_sub_field('image');
                if($image == "" ) continue;
                    ?>
                    <li data-target="#myCarousel" data-slide-to="<?php echo $num ?>" class="<?php echo $active ?>"></li>
                    <?php
                    $active = '';
                    $num += 1;
                endwhile; ?>
 </ul>

 <!-- The slideshow -->
 <div class="carousel-inner">
 <?php
                $active = 'active';
                while ( have_rows('images') ) : the_row();
                $image = get_sub_field('image');
                if($image == "" ) continue;
                    ?>
                    <div class="carousel-item <?php echo $active ?> screen08">
                        <div class="container">
                            <img src="<?php echo get_template_directory_uri(); ?>/files/images/<?php the_sub_field('image'); ?>" class="img-fluid is-slider-item" />
                        </div>
                    </div><!-- /item -->
                    <?php $active = '';
                endwhile;
                ?>  </div>

 <!-- Left and right controls -->
 <a class="carousel-control-prev" href="#myCarousel" data-slide="prev">
 <span class="carousel-control-prev-icon"></span>
 </a>
 <a class="carousel-control-next" href="#myCarousel" data-slide="next">
 <span class="carousel-control-next-icon"></span>
 </a>
 </div>
 <?php endif; ?>

Many thanks in advance for your hints!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda