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

222
Visualizações
Swiperjs Detect Swipe Direction?

I'm creating a calendar web app that shows each day's memos I took. studia app

It looks like this, and I wanted to add a "swipe" gesture for mobile users.

And then, I realized swiperjs. I created a swiper with only 1 slide and gave it a loop. It worked perfectly.

But the problem is that the swiper index always gives me 1.

Using event listeners (like slideChange) I need to detect the swipe direction and load the next day's memos.

Is there a specific event listener (something like swipeLeft) or a value returned that gives me the direction?

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

0

Finally found it.

on: {
  slideChange: (swiper) => {
    console.log(swiper.touches.diff < 0);
  }
}

Returns true when swipe right, false when left.

NOTE: swiper.touches.diff will be 0 when the slide is changed by the Navigation Arrows. To do that add event listeners to the buttons, too.

about 4 years ago · Juan Pablo Isaza Relatório

0

For me this works well

const direction = swiper.touches.startX > swiper.touches.currentX ? 'forward' : 'backward';
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