Change Slide Bootstrap Transition

Asked

Viewed 1,627 times

1

I need to decrease slide transition time Bootstrapp, how can I do while the files js and css are being pulled from the site?

<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
    <div class="carousel-item active">
        <img src="http://www.esquadros.com.br/Img/Sitecomp/banner_lctl2_min.jpg" class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
        <img src="http://www.esquadros.com.br/Img/Sitecomp/banner_home_4_min.jpg" class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
        <img src="http://www.esquadros.com.br/Img/Sitecomp/perfiladeira-min-2.jpg" class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
        <img src="http://www.esquadros.com.br/Img/Sitecomp/banner-home-5.jpg" class="d-block w-100" alt="...">
    </div>
    <div class="carousel-item">
        <img src="http://www.esquadros.com.br/Img/Sitecomp/banner_profil_min.jpg" class="d-block w-100" alt="...">
    </div>
</div>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
</a>
<h1>Inovação e Tecnologia <br> no processamento de bobinas</h1>
<button type="button" class="botao-topo">Conheça nossa Empresa</button>

1 answer

1


Dear your answer is in the documentation: https://getbootstrap.com/docs/4.0/components/carousel/#options

The value you put on data-interval="X" is the time it will take the transition between one slider and another.

Then the slider tag would look like this to go from 1 in 1 second for example.

<div data-interval="1000" id="carouselExampleControls" class="carousel slide"  data-ride="carousel">

inserir a descrição da imagem aqui

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Page Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="screen" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css" />
<style>
    
</style>
</head>
<body>
    
    <div data-interval="1000" id="carouselExampleControls" class="carousel slide" data-ride="carousel">
        <div class="carousel-inner">
          <div class="carousel-item active">
            <img src="http://www.esquadros.com.br/Img/Sitecomp/banner_lctl2_min.jpg" class="d-block w-100" alt="...">
          </div>
          <div class="carousel-item">
            <img src="http://www.esquadros.com.br/Img/Sitecomp/banner_home_4_min.jpg" class="d-block w-100" alt="...">
          </div>
          <div class="carousel-item">
            <img src="http://www.esquadros.com.br/Img/Sitecomp/perfiladeira-min-2.jpg" class="d-block w-100" alt="...">
          </div>
          <div class="carousel-item">
              <img src="http://www.esquadros.com.br/Img/Sitecomp/banner-home-5.jpg" class="d-block w-100" alt="...">
            </div>
            <div class="carousel-item">
                <img src="http://www.esquadros.com.br/Img/Sitecomp/banner_profil_min.jpg" class="d-block w-100" alt="...">
              </div>
        </div>
        <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
          <span class="carousel-control-prev-icon" aria-hidden="true"></span>
          <span class="sr-only">Previous</span>
        </a>
        <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="sr-only">Next</span>
        </a>
        <h1>Inovação e Tecnologia <br> no processamento de bobinas</h1>
        <button type="button" class="botao-topo">Conheça nossa Empresa</button>

      </div>
    
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
</body>
</html>

  • 1

    $('.carousel').carousel({&#xA; interval: 2000&#xA;})in Javascript tbm

  • @Viniciusdejesus yes da para fazer direto pelo JS tb. I even edited my answer to demonstrate the example, because data-interval="n" vc sets up straight on the tag if I have more than one slider on the page facilitates etc

  • Thanks guys! It worked out.

  • @Renanranzani quiet young, how nice that it worked. If you think it is answered consider mark this icon below the arrows there next to the answer. So your question is not pending without accepted answer, even if it has already been solved. Abs

  • 1

    Done, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.