Adding jquery mobile swipe event

后端 未结 5 2110
春和景丽
春和景丽 2020-12-04 15:45

I have a listview and what I am trying to do is add a swipe event on the links. For example, if a user swipes the first link it goes to that page. Is this possible with list

5条回答
  •  佛祖请我去吃肉
    2020-12-04 16:16

    If you want the page to slide in the natural direction that the user swipes, then do it like this:

    // For a left swipe: page slides from right to left
    $('#listitem').on('swipeleft', function() {
        $.mobile.changePage('#page-to-left', { transition: slide});
    });
    
    // For a right swipe: page slides from left to right (add "reverse: true")
    $('#listitem').on('swiperight', function() {
        $.mobile.changePage('#page-to-right', { transition: slide, reverse: true});
    });
    

提交回复
热议问题