How to stop the swipe event in jQTouch whilst a slide transition is occuring?

Deadly 提交于 2019-12-06 21:52:30

I fixed the problem. If people have a better solution , let me know.

I created a singleton called "delay"

        var delay = (function(){

            wait = false;
            return {

                set:function(bool_wait){
                      wait = bool_wait;
                    },

                get:function(){
                  return wait;
                  }
              }
        })();

"I know its a global" , You can implement this anyway you want. Its the quick fix. Just put it in a script called delay.js and attach it to the beginning of ur document.

Now when you call "Swipe"

Do the following

$('#div.touch').swipe(function(e,info){

               if(delay.get() === false){

                switch(info.direction){
                       case 'left':
                       jQT.goTo('#test', 'slide');
                       break;
                }       

                 delay.set(true);
                 setTimeout(function(){delay.set(false)},1000);

              }
        });

This just puts a 1 second delay between swiping.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!