ios6 touch event handling javascript

安稳与你 提交于 2019-12-25 18:56:06

问题


I am trying to improve the touchwipe js. where i want to hanlde only horizontal scroll and if its any vertical scrolling comes up let browser handle my fix works fine in ios5 but in ios6 its getting frezee any idea ?

http://archive.plugins.jquery.com/project/Touchwipe-iPhone-iPad-wipe-gesture

Please find code following

function onTouchMove(e) {   

         //var e = (e.changedTouches != undefined)? touches[0] : e; 
         if(isMoving) {              
             var x = e.touches[0].pageX;
             var dx = startX - x;
             if(Math.abs(dx) >= config.min_move_x)
             {
                 if(config.preventDefaultEvents) { 
                     e.preventDefault();                 
                 }
                cancelTouch();
                if(dx > 0) {
                    config.wipeLeft();
                }
                else {
                    config.wipeRight();
                }
                return false;
            }
             else {
                   console.log('y moving.. ');
                   // attachTouch();
                    return true;
             }
         }

     }

Just adding some more details . I am trying to animate my list horizontal by BXslider and its works fine want to support the touch events so added the touch wipe jquery . But adding it give 1 issue that's horizontal scroll animation works ok but touch page vertical scroll not works.

So i tried to fixed issue by return true; if its only Y move, at touchwipe js. This fix working fine on android4 and ios5 but fails in ios6 if i scroll my page vertically little aggressively(moving finger in oval/circle for 4-5 sec) its freez bxslider animation.

further debugging give inside that bxslider.gotoNextSlide()-> calling the Jquery $parent.animate() method for sliding which stop working in ios6 after aggressive scroll.

Now i m stuck and not able to understand why this animate() stops working ??

EG >>>

http://jsfiddle.net/qtCHx/


回答1:


This probably happens due to this bug: http://bugs.jquery.com/ticket/12620

A temporary solution here: https://gist.github.com/3798925



来源:https://stackoverflow.com/questions/12701463/ios6-touch-event-handling-javascript

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