开发者

jQTouch swipe not working

I tried to get the swipe to work in jQTouch, and after a while it finally worked, but with a big problem: almost every time I swipe, the page jerks back and forth until it lands on the target page (div). Here's the code:

        jQuery('.swipe').bind("swipe",function(event, info){
            if (info.direction === 'right') {
                jQT.goBack(1);
            }
        });

And I have the class swipe set on each section div, like so:

 <div id="concept-1" class="swipe">

I tried following tips found by Googling, many of which talked about setting touchselector: '.swipe' (in my case to .swipe at least) in the initializer for jQTouch, but if I did that normal tapping of buttons/links did not work anymore, and besides, the swiping seemed to "work" anyway, just not in a usable way...

What am I doing wrong, and how do I get it to work? I'm trying to make it go back one page when you swipe right, as an alternati开发者_如何学运维ve to clicking the back button.

EDIT: Some more info: eventually after a few swipes, the app freezes completely too...


I had the same problem. Unfortunately the Swipe function is very unreliable.. but you can avoid the browser crash by simulating the browser history back button instead of the jqTouch goBack function. Here is my code:

$('.swipe').swipe( function(event, info){

    var currentpage = $('.current').attr('id'); 

     if (info.direction === 'left') {
          jQT.goTo($('#home'), 'dissolve');
      }else if (info.direction === 'right' && currentpage !="home") {
           history.go(-1);
     }  
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜