【问题标题】:Hammer.js pinchin/pinchout events not firing (How to debug android)Hammer.js pinchin/pinchout 事件未触发(如何调试 android)
【发布时间】:2013-07-30 09:49:22
【问题描述】:

我正在使用hammer.js 来捕获捏合事件以模拟放大和缩小,但是当我使用我的Galaxy Tab 2 (android 4.1) 对其进行测试时,没有任何事件触发

html:

<img class='image' src="http://lorempixel.com/output/nature-q-c-1073-779-9.jpg"></img>

脚本:

$(function(){
var imageElems = $('.image');
alert('count: '+imageElems.length); //returns 'count: 1'

imageElems.hammer({prevent_default:true})
    .on("pinchin", function (evt)
    {
        alert('zoom out');
        //more stuff
    }).on("pinchout", function (evt)
    {
        alert('zoom in');
        //more stuff
    }); 


//this alert doesn't fire on android device (not tested on any other)
alert('done');
});

这是一个小提琴:http://jsfiddle.net/7EV56/6/

第二个警报永远不会在 android 上触发。我假设这是因为有一个错误,但它不会在我的 PC 上的浏览​​器中发生(但我无法测试捏合)。如何找出 android chrome 发生了什么错误。

有什么想法吗?

【问题讨论】:

    标签: javascript android pinchzoom hammer.js


    【解决方案1】:

    知道了。我直接从 GitHub 提供了hammer.js 库,但他们故意使用 MIME 类型的 text/plain 来提供它,这在 chrome 中是不可执行的。

    https://code.google.com/p/chromium/issues/detail?id=180007

    然而,主要问题是无法在我的平板电脑上调试它,但现在我已经安装了 chrome ADB plugin,这很有帮助。一旦我发现了实际错误,就很容易了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-16
      • 1970-01-01
      • 2016-06-06
      相关资源
      最近更新 更多