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

223
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

For me this works well

const direction = swiper.touches.startX > swiper.touches.currentX ? 'forward' : 'backward';
about 4 years ago · Juan Pablo Isaza Denunciar
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