Skip to content

Swipe on trackpad #2

@mig-hub

Description

@mig-hub

Hello, Thank you for the great work on this library.

I have specifically chosen your library because yours seems to handle swipe on devices that are not touch screens. I have made it work on touchscreens without any problem, but I struggle to make it work on my laptop. I have enabled the mouse I assume because I used it like this:

<div
    use:swipeable={{ trackMouse: true }}
    on:swipedleft={ goNext }
  on:swipedright={ goPrev }
  ...
>
  ...
</div>

It probably boils down to what I understand defines a swipe when you have a mouse, even more so a trackpad in my case. What I am trying to achieve, which is probably quite common with your library, is to have a slideshow that loops which is triggered on click. So I already have a click event which determines if it goes next or prev depending on which side of the slideshow was clicked. But I want it to work when visitors think they need to scroll instead. By adding the code above, it does work on touch screen. But not if I try to scroll on touchpad.

Maybe it's not really as easy as that because a trackpad is sort of in between and also the gesture people use to scroll is actually defined by the browser. In my case it is a scroll gesture with 2 fingers, but it could be different for somebody else. Therefore I thought the most appropriate route is still to detect a sort or scroll. But as far as I know, there is no such thing as a scroll event on something that does not technically scroll.

Anyway, I wanted to have your opinion on this and if you know a way to achieve what I am trying to achieve.

Thank you in advance.

Best,
Mickael

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions