Simulate swipe with mouse in javascript

后端 未结 5 1955
说谎
说谎 2020-12-31 05:05

I\'m trying to make an image rotator that works on mobile devices using swipe for navigation. I\'m also trying to make the same rotator to work on PC browsers but to be able

相关标签:
5条回答
  • 2020-12-31 05:06

    You'll want to handle onmousedown, onmousemove, and onmouseup events, keeping track of the mouse position and manipulating your image rotator accordingly.

    0 讨论(0)
  • 2020-12-31 05:18

    I believe you are looking for this answer: Standalone jQuery "touch" method?

    The accepted answer has code to implement swipe left/right support and another answer lower down has a link to a plugin that does a similar task: http://www.netcu.de/jquery-touchwipe-iphone-ipad-library (this plugin allows detection of swipes in four directions).

    0 讨论(0)
  • 2020-12-31 05:20

    I've looked into most of these... I'd recommend looking into

    Hammer.Js

    From what little I've seen, it has support for both desktop and mobile swiping and I was impressed with the demos.

    0 讨论(0)
  • 2020-12-31 05:23

    When you use Hammer.js, you also have support for touch/mouse and pointer events. This for touch screen laptops like the chromebook pixel and windows8. Most of the libraries out there dont support those yet.

    0 讨论(0)
  • 2020-12-31 05:25

    I ended up using iDangerous iSwiper, which met all my needs and is (IMO) very excellent.

    0 讨论(0)
提交回复
热议问题