在移动设备上向左/向右滑动事件,如“点击”

时间:2021-01-21 19:51:27

标签: javascript html jquery

我需要帮助: 我有一个带有下一个箭头和图像上一个箭头的经典轮播;我需要像点击一样更改事件,在切换下一个或上一个图像的事件中。

这个:

$('.next-arrow").click(function({
    //Move the carousel to the next photo
})

$('.prev-arrow").click(function({
    //Move the carousel to the prev photo
})

像这样:

$('.mycarousel").svipe on right (function({
    //Move the carousel to the next photo
})

$('.mycarousel").svipe on left(function({
    //Move the carousel to the prev photo
})

谢谢!

1 个答案:

答案 0 :(得分:0)

看看一个hammer.js - https://hammerjs.github.io/recognizer-swipe/。好像有你要找的东西。