Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swipe events does not fire. #13

Open
p6laris opened this issue Jun 30, 2024 · 1 comment
Open

Swipe events does not fire. #13

p6laris opened this issue Jun 30, 2024 · 1 comment

Comments

@p6laris
Copy link

p6laris commented Jun 30, 2024

Hi
I registered for all four swipe events, but surprisingly only the right one will fire. i don't if it's because of the touch pad or something else:

import TinyGesture from "https://unpkg.com/[email protected]/dist/TinyGesture.js";

function initSlider(target)
{
    const instance = new TinyGesture(target);
    console.log(instance)

    instance.on("swipeleft", async event => {
        console.log("swiped left")
    });
    
    instance.on("swiperight", async event => {
        console.log("swiped right")
    });
    
    instance.on("swipeup", async event => {
        console.log("swiped up")
    });
    
    instance.on("swipedown", async event => {
        console.log("swiped down")
    });
}

document.addEventListener("DOMContentLoaded", () => {
  document.querySelectorAll(".swipe").forEach(initSlider);
});
@p6laris
Copy link
Author

p6laris commented Jul 1, 2024

I managed to make it work by setting the velocityThreshold to 0, and only 0 works. any fix for that would be great.
Thanks.

  const instance = new TinyGesture(target, { 
    diagonalSwipes: true,
    velocityThreshold: 0, 
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant