【发布时间】: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