本文介绍了在发生幻灯片过渡时,如何在jQTouch中停止滑动事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎完成了一个混合站点,还有一个我无法解决的问题(许多原因是由于现在Sencha库中故意缺乏文档).

I've almost finished a hybrid site and theres one issue I cant resolve (many due to the deliberate lack of documention on the now Sencha library).

我在滑动时有绑定的事件,即左右滑动,正确的动画,它是在我快速滑动或滑动时发生的-页面开始转换(滑动)-在重新转位时再次滑动.我抛出jQtouch并导致黑页.

I have a binded event on the swipe, left and right, proper animations, its just when I swipe quickly, or I swipe - the page starts to transition (slide) - whilest transisitoning I swipe again. I throws jQtouch and results in a black page.

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

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

我认为'pageAnimationEnd'可能是我需要以某种方式使用和配合的事件.但是对于菜鸟来说,指针会很好. :)

I'm thinking 'pageAnimationEnd' will probably be the event I need to use and tie in somehow. But pointers would be good, for a noob. :)

推荐答案

我已解决此问题.如果人们有更好的解决方案,请告诉我.

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;
                  }
              }
        })();

我知道它是一个全局的",您可以随时执行此操作.它的快速修复.只需将其放在名为delay.js的脚本中,并将其附加到ur文档的开头即可.

"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"

执行以下操作

$('#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);

              }
        });

这仅会使刷卡之间延迟1秒.

This just puts a 1 second delay between swiping.

这篇关于在发生幻灯片过渡时,如何在jQTouch中停止滑动事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 02:50