【问题标题】:android 2.2 browser dont work pageY or PageX in ontouchend eventandroid 2.2 浏览器在 ontouchend 事件中不工作 pageY 或 PageX
【发布时间】:2010-05-28 04:14:50
【问题描述】:

我有一个在 android 2.1 中完美运行的网络应用程序,当我升级到 2.2 时,ontouchend 事件中的 pageX 属性,这是我的代码:

menu1.ontouchend = 功能(e){ e.preventDefault(); if (e.touches && e.touches.length>0) { // iPhone x2 = e.touches[0].pageX; y2 = e.touches[0].pageY; } else { // 所有其他 x2 = e.pageX; y2 = e.pageY; } }

任何人都知道从 2.1 到 2.2 触摸事件的 javascript API 有何变化??????

【问题讨论】:

  • 据我所知,startX 和 startY 也坏了。我还没有找到解决方法。

标签: javascript android-2.2-froyo


【解决方案1】:

你可以试试:

event.targetTouches[0].pageX

如果这不起作用,请检查您是否可以从“touchmove”事件中获取此属性。如果是,则存储此值(在“touchmove”事件中访问它时)并在“touchend”事件期间加载它。

【讨论】:

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