手机浏览器事件

1.低版本的手机QQ内置浏览器,微信内置浏览器不支持鼠标事件

    $('#startBtn').parent().on({
                mousedown: function () {
                    game.quicken(1);
                },
                mouseup: function () {
                    if (mouseTimer) {
                        clearTimeout(mouseTimer);
                    }
                    mouseTimer = setTimeout(function () {
                        clickTimeSpan = 300;
                        setTimeout(function () {
                            clickTimeSpan = 500;
                        }, 200);
                    }, 400);
                },
                dblclick: function () {
                    return false;
                }
            });

2.但是支持触摸事件

            $('#startBtn').parent().on({
                touchstart:function(){
                    game.quicken(1);
                    return false;
                },
                touchend: function () {
                    if (mouseTimer) {
                        clearTimeout(mouseTimer);
                    }
                    mouseTimer = setTimeout(function () {
                        clickTimeSpan = 300;
                        setTimeout(function () {
                            clickTimeSpan = 500;
                        }, 200);
                    }, 400);
                }
            });

 

posted @ 2015-12-18 19:15  天马3798  阅读(463)  评论(0编辑  收藏  举报