Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
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 answers
Answer question

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 Report

0

For me this works well

const direction = swiper.touches.startX > swiper.touches.currentX ? 'forward' : 'backward';
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!