如何捕捉 jQuery 的滑动类型?

How do I catch the swipe type with jQuery?

我在 jQuery 中有这些代码行,我需要在字符串中捕获 swype 类型的名称。

$('.client-content').on('swipeleft swiperight', function(){

        var curActiveClient = $('.clients-belt').find('.active-client'),
            position = $('.clients-belt').children().index(curActiveClient),
            clientNum = $('.client-unit').length;

        if (event === 'swipeleft') {

            //do something

        } else if (event === 'swiperight') {

            //do something else

        }

如果我没理解错的话,你想要知道滑动是向左还是向右...

$('.client-content').on('swipe', function(){
   var curActiveClient = $('.clients-belt').find('.active-client'),
      position = $('.clients-belt').children().index(curActiveClient),
      clientNum = $('.client-unit').length;

   $(this).on("swipeleft", function(){
   //some code
   })
   $(this).on("swiperight", function(){
   //some code
   })
}