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

247
Visualizações
Finding the index of a owl carousel depending on where the user is at on the carousel

as mentioned above, is there a way to obtain the index of the carousel?

enter image description here

I want to change the text (indicated in the red arrow) based on the position of where the user is (blue arrow). I

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use carousel events as per the document. Please try the below code.

var owl;
$(document).ready(function(){
  owl = $(".owl-carousel").owlCarousel({
    autoplay: false,
    autoplaySpeed: 300,
    loop: false,
    navSpeed: 300,
    items: 1,
    margin: 2
  });
  owl.on('changed.owl.carousel', function(e) {
    $('#continue-btn').html('Continue ' + e.item.index);
  });
});
body {
  margin: 0;
  padding: 0;
}

.owl-carousel .item {
  height: 120px;
  background: #4DC7A0;
  padding: 1rem;
  list-style: none;
  margin: 10px;
  text-align: center;
  color: white;
  font-size: 20px;
  line-height: 120px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.1.6/assets/owl.carousel.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.1.6/assets/owl.theme.default.min.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.1.6/owl.carousel.min.js"></script>

<div class="owl-carousel">
  <div class="item"> slide1 </div>
  <div class="item"> slide2 </div>
  <div class="item"> slide3 </div>
  <div class="item"> slide4 </div>
  <div class="item"> slide5 </div>
  <div class="item"> slide6 </div>
  <div class="item"> slide7 </div>
  <div class="item"> slide8 </div>
  <div class="item"> slide9 </div>
</div>
<button id="continue-btn">
Continue
</button>

about 4 years ago · Juan Pablo Isaza Relatório
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