手機瀏覽器事件

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);
                }
            });
相關文章
相關標籤/搜索