Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

187
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda